- Home /
The question is answered, right answer was accepted
Gravity is preventing object from moving straight toward its direction when calling rigidbody.AddForce...
When gravity is enabled, the cube, which contains a rigidbody and a box collider, will not move precisely toward its direction when using rigidbody.AddForce
. I have also tried changing the velocity directly to move the object, but it didn't change anything.
What are the reasons to why when gravity is disabled, it will go straight? What can we do to resolve it without having to disable gravity?
Here is the link to my script, which is C#: http://pastebin.com/Kpge7vSe
preventing it from NOT going straight? or preventing it from going straight?
Whoops! Haha, I apologize for that. I meant, "preventing it from going straight". :)
Answer by Kiwasi · May 28, 2014 at 09:27 PM
Physics 101: Objects under gravity don't move in straight lines, they follow a parabola.
If you want an object to move in a straight line disable gravity. You could also add a lift force that is equal and opposite to gravity.
If you want accurate physics behaviour with you are going to have to deal with non straight lines. Physics simulation is not about making something go where you want, its about where something would go under real life conditions.