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#:
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.