Animate Character with Colliders

A few questions here:

  • If I create an animation to move a gameobject with rigidbody and Animate Physics, will it modify transform.position or rigidbody.position? It’s not really clear from documentation how it affects performance.
  • How would I go about creating an animated character (bone animation) with colliders on every part of the body. Do I need to add a rigidbody to every part that has a collider to avoid performance issues?
  • Also how do I change the scale of a gameobject with a rigidbody correctly at runtime?
  1. When you apply rigidbody.addVelocity(), The result happens on transform.position on the next physics simulation step. “Rigidbody.position allows you to get and set the position of a Rigidbody using the physics engine.This is faster than updating the position using Transform.position, as the latter will cause all attached Colliders to recalculate their positions relative to the Rigidbody.” Depends how you want to work. Both will work.

  2. An object does not need to have a rigidbody component to collide. I would Apply Rigidbody with ‘isKinematic’ checked if anything. “Kinematic rigidbodies are also particularly useful for making characters which are normally driven by an animation, but on certain events can be quickly turned into a ragdoll by setting isKinematic to false.” is when it is very useful.

  3. Interpolate the transform.localScale over time. (use LERP or SLERP, or come up with your own animated method using time.deltaTime)

Regarding scaling a Rigidbody with Collider, I made some tests, and the performance is even worse than moving it with transform.position:

1 Like