- Home /
Whats the difference between a rigid body and a collider?
I know it's noobish question, sorry. :P
Answer by Statement · Jan 12, 2011 at 09:45 PM
A Collider is the "physical form" of objects. There are several types of colliders, such as box shaped, sphere shaped, capsule shaped or even custom (mesh) shaped (and then some!).
A Colliders' responsibility is to aid collision detection in any way. It can be used for triggers, for physics or other uses.
A Rigidbody is a representation of a rigid body in space. It is used by the physics engine to perform collision response and movement of objects.
A Rigidbody makes use of a Collider to define it's shape.
Can you please tell me the difference between transform.position.x and rigidbody.position.x because when i use it in code like shown below, rigidbody.position = new Vector3(rigidbody.position.x,0,16.0f);
or, transform.position = new Vector3(rigidbody.position.x,0,16.0f);
or, transform.position = new Vector3(transform.position.x,0,16.0f);
they all do the same thing.. so i was just wondering what is the difference between them.... I know its a noobish question but I just started learning unity 2 days before.
I can't give you a straight answer on this but I would guess that it may have to do with physics interpolation. Interpolation means that movement appear smooth (even though it is not). I suspect that rigidbody.position is the actual position of the rigidbody and that transform.position is the visual position of the object. Physics update on a different time step than rendering. To see this in action you can change Fixed Timestep and $$anonymous$$aximum Allowed Timestep to 1 in Edit/Project Settings/Time. Add an object with a rigidbody and see it fall down one step every second. If you change the interpolation mode on the rigidbody to either Interpolate or Extrapolate you can see how it appear smooth, but if it bounces against something you realise that the motion is not physics driven but only a best guess of where the object should be between earlier physics steps (interpolation) or a future prediction (extrapolation).
Answer by jharri30 · Jan 25, 2014 at 03:23 PM
This post may help as well...
http://answers.unity3d.com/questions/129796/rigidbodoy-vs-collider.html