newbie question regarding torque #259
-
I modified the hello world code by turning off gravity and applying a local force (10, 0, 0):
When I run this I get what I expect
If I then apply a local torque I get
Why is there a non-zero Y component to the position? How does applying a local torque change the direction of motion? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hello. Thanks for your question. This is expected because you are applying a local force along the local x direction of your body and at the same time a local torque around the z axis. Therefore, the torque that you apply will rotate your body. Next, when your local force will be applied to the local x axis of the body, this local axis have been rotated in the world because of the previous body rotation. Therefore, this local x axis will have a component in the direction of the world-space y axis. That's why the y component of the body position changes. Remember that the local-space is attached to your rigid-body and will rotate with it if the body rotates. What you probably want instead in your case is to apply a force in world-space along the x direction using the following method:
I hope my explanation is clear enough. |
Beta Was this translation helpful? Give feedback.
Hello. Thanks for your question.
This is expected because you are applying a local force along the local x direction of your body and at the same time a local torque around the z axis. Therefore, the torque that you apply will rotate your body. Next, when your local force will be applied to the local x axis of the body, this local axis have been rotated in the world because of the previous body rotation. Therefore, this local x axis will have a component in the direction of the world-space y axis. That's why the y component of the body position changes.
Remember that the local-space is attached to your rigid-body and will rotate with it if the body rotates.
What you probably want instead …