A ChipmunkBody tracks and controls the physical properties of an physics enabled object in your game, such as its mass, position, and rotation.
Like a PhysX RigidBody, it doesn't have a specific shape, instead you can add one or more shapes to the gameObject and its children so you have a physical shape to interact with. Every time the physics simulation runs (during Unity's FixedUpdate call), the position of the body changes in response to the simulation (gravity, etc).
When working with ChipmunkBodies, make sure to change the body's position and rotation, not the transform. When you've added a ChipmunkBody to an object, it is now driven by the physics engine, so changes to the transform will be overwritten.
- Mass - The mass of the object, most often manifest as its weight here on Earth. In Chipmunk2D, the simulation isn't tied to any specific unit, so you can mentally map it to whatever unit is appropriate for your game. Items with larger relative mass will be more resistant to motion.
- Moment Calculation Mode
- Calculate From Shapes - Automatically calculate a moment of inertia based on attached shapes. (Recommended by default)
- Do Not Rotate - Don't allow this object to rotate. (Infinite moment of inertia)
- Override - Specify a custom value for the moment in the field below.
- Custom Moment - If you chose Override above, you can use this field to specify a custom moment of inertia. The moment is an object's resistance to rotation, similar to how mass is the resistance to linear motion. These numbers tend to be hard to make up offhand, so it's usually better to calculate them mathematically in code. For more info, check wikipedia.
- Is Kinematic - Mirrors the behavior of PhysX's isKinematic flag. Objects marked Kinematic will not be driven by the physics engine. Turning kinematic on and off is a good way of turning animation-driven object into physics-driven objects and back.
- Interpolation - Chipmunk2D, like PhysX, updates the physics during the fixed timestep, thus decoupling the rendering from the simulation of the game. This means you might get multiple frames rendered before stepping the physics, which can cause a jittering effect. Chipmunk supports extrapolation, which smooths motion between Update frames. We recommend turning it on in any situation where the jittering is noticeable, particularly when you're following something with a camera in LateUpdate. This feature is the same as the Unity provided interpolation. Extrapolation is initially supported by Chipmunk2D, and Interpolation is expected later.
Unlike PhysX and Box2D, Chipmunk is not very sensitive to units and doesn't need much tuning. So you don't need to be as careful with different (very large or small) object sizes causing performance or stability problems.
Multiple shapes can be attached to each body. If you have more than one shape, attach each shape as children of the body. Like PhysX, any shape beneath the body in the hierarchy is a shape that is applied to that body.