Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So I have a rotating object a. It is rotating at non-constant speed around it's local x axis. It is parented to object b. When the object a rotates, it's local x axis stays facing the same direction relatively to object b, but not the local y and local z axis. The problem in image
In image the problem is explained a bit better. So I need to get a vector that is relative to the local x axis, but rotated by 90 degrees. And it should always match the b object's local y arrow's rotation around it's local x arrow. And I need to obtain a vector in global axis. I hope that you understand my problem. So all I need is the math behind. Of course, if there is need for a dot product or cross product or something similar down there, please, don't start typing down all the math of that function:D

share|improve this question
1  
A bit of background information could help: what are you trying to achieve? – Alexandre Vaillancourt Mar 2 at 14:11
    
@AlexandreVaillancourt Hm... Why do you need to know? I am trying to get a global space vector in which to apply force. That's all. But it should equal to the rotating cylinder's facing direction. And not the local axis, because they're rotating all the time and face in the correct direction only in few cases(when a full circle of rotation is complete). – Adrians Netlis Mar 2 at 15:03
    
I don't know how to BUMP in this site, but I need to do it. It's already getting desperated when nobody even tries to answer ;( – Adrians Netlis Mar 3 at 6:09
    
To bump a question, you typically edit it. It will make it come back to the top of the active question list. A couple of things you could do to improve it is to crop the image that you have uploaded: a lot of white space around what's important creates discontinuity in the question. Also, the issue looks like a relatively simple vector math one, but unfortunately, it's a bit hard do really understand what you need. Explaining in terms of real-world terms (e.g. "b is an engine powering a, which is a flywheel that holds paddles for propulsion") helps a lot figure our stuff. – Alexandre Vaillancourt Mar 3 at 14:22
    
OK! NVM, I think I solved it, car.getAxisVect((0, 1,0)).cross(wheel.getAxisVect((1, 0, 0))).normalized() as I use BGE. I need somebody to confirm this. – Adrians Netlis Mar 3 at 15:52
up vote 0 down vote accepted

So I found a solution. I can use a globalized vector for the b object's local z axis and cross it by the globalized vector of local wheel's x axis. Than normalize it. So in my game engine(Blender Game Engine) I can do it this way:

direction = b.getAxisVect((0, 0, 1)).cross(a.getAxisVect((1, 0, 0)))

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.