So I've been working on this incredibly complex control system only to discover "addRelativeForce" and facepalm.
Say I have a rigidbody sitting on a moving object, and I want it to move at a goal speed in relation to the object it's on. (For example, character run at 10mph + the train's speed of 40mph.)
From what I understand, using addForce for this will simply make my character attempt to reach a grand total of 10mph, whereas addRelativeForce will make my character attempt to reach 10mph + the train's speed.
Is this about right?
asked Oct 05 '10 at 08:39 PM
No, not quite.
AddForce adds force in world coordinates and AddRelativeForce adds force in local coordinates.
is the same as
If you have a rigidbody sitting atop a moving object, the amount of force transferred from the the moving object to the rigidbody is determined by the amount of friction on both of the objects' collider's physic material, the amount of force pushing the body against the moving object and the mass of the rigidbody. If you have no friction, you would have to add the force of the moving object while they are in contact.
AddForce will always add force. If you are moving with the same forces as the train (however you decide to achieve this), when you AddForce on top of that, you will be moving with that much more force than the train.
Force is not measured in units of velocity(distance/time), but in units of Force (Newtons or whatever). Applying a force doesn't necessarily apply enough force to reach velocity x except in a completely empty and appropriately setup system because of things like drag, surface interactions and constant forces and the like which will affect velocity in different ways. With drag, the rigidbody will slow to a stop as it moves. Physic materials and collisions can easily have a wide variety of effects on velocity from bouncing back with equivalent force to friction adding the velocity of whatever was collided with.
answered Oct 05 '10 at 09:00 PM