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.

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

  • 1
    \$\begingroup\$ A bit of background information could help: what are you trying to achieve? \$\endgroup\$ – Vaillancourt Mar 2 '16 at 14:11
  • \$\begingroup\$ @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). \$\endgroup\$ – Adrians Netlis Mar 2 '16 at 15:03
  • \$\begingroup\$ 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 ;( \$\endgroup\$ – Adrians Netlis Mar 3 '16 at 6:09
  • \$\begingroup\$ 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. \$\endgroup\$ – Vaillancourt Mar 3 '16 at 14:22
  • \$\begingroup\$ 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. \$\endgroup\$ – Adrians Netlis Mar 3 '16 at 15:52

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)))


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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