Hello,
I wanted to track the acceleration that results from applying a force in only the z direction to a cube rigid body. For some reason, the acceleration vector always has an alternating y-component. When I turn gravity off on the rigid body options, there is no y-component. This doesn’t make sense to me since theoretically since the cube is on the ground (a plane or just another cube), adding a horizontal force shouldn’t have any effect in the vertical direction. Could someone clarify this situation for me?
Thanks.
The portion of the engine that manages physics adds together all the forces and torques acting on an object into a net force and net torque. It then uses this net force and net torque to figure out what the object’s position and rotation should be next. After figuring out where all objects will be transformed next, it solves the results of any collision that happen from the movement. If the objects have gone through each other a little bit, the manager then attempts to correct it.
Additionally, after an object is in contact with a static collider, it will be taken out of the calculations until something else hits it. This last thing is known as “sleeping”, and it is to save the physics from bunch of unnecessary calculations, such has trying to calculate a stack of boxes on the ground.
What you are probably seeing when the force is acted your object:
-
the object wakes up, so now forces are affecting its transform.
-
there are two forces acting on it: one in the Z direction, and gravity in the Y direction. They are added together for the net force.
-
The next position and rotation are calculated, which is somewhere below the ground and forward in the Z axis.
-
The collision gets solved - instead of going through the floor, your object is calculated to stay above it, even though there is a force continually pulling it down.
-
After the manager realizes the object’s position and rotation are the same after a while, i.e. it must have stopped, it falls asleep and is no longer calculated.