Physics Components
 Manual Reference Scripting
 Reference Manual > Components > Physics Components

 このドキュメントは有志により翻訳されたもので、オフィシャルではありません。オリジナルのページはこちら。This document is unofficially translated by users.Please see the original document here.翻訳に関する修正など、ご連絡はこちらまで。Please send e-mail to here, when you have any question about the translation.

# Physics Components

Unity has the next-generation Ageia PhysX physics engine built-in. This allows for unique emergent behaviour and is generally very cool.

## Basics

To put an object under physics control, simply add a Rigidbody to it. When you do this, the object will be affected by gravity, and can collide with other objects in the world.

### Rigidbodies

You use Rigidbodies for things that the player can push around, eg. crates or loose objects. You can also add Joints to rigidbodies to make the behavior more complex. For example, you could make a physical door or a crane with a swinging chain.

You also use Rigidbodies to bring vehicles to life, for example you can make cars using a Rigidbody, 4 Wheel Colliders and a script applying wheel forces based on the user's Input.

You can make airplanes by applying forces to the Rigidbody from a script. Or you can create special vehicles or robots by adding various Joints and applying forces via scripting.

Rigidbodies are most often used in combination with primitive colliders.

Tips:

• You should never have a parent and child rigidbody together
• You should never scale the parent of a rigidbody

### Kinematic Rigidbodies

Kinematic Rigidbodies are not affected by forces, gravity or collisions. They are driven explicitly by setting the position and rotation of the transform or animating them, yet they can interact with other non-Kinematic Rigidbodies.

Kinematic Rigidbodies are used for three purposes:

1. Sometimes you want an object to be under physics control but in another situation to be controlled explicitly from a script or animation. For example you could make an animated character whose bones have Rigidbodies attached that are connected with joints for use as a Ragdoll. Most of the time the character is under animation control, thus you make the Rigidbody Kinematic. But when he gets hit you want him to turn into a Ragdoll and be affected by physics. To accomplish this, you simply disable the isKinematic property.
2. Kinematic Rigidbodies play better with other Rigidbodies. For example if you have an animated platform and you want to place some Rigidbody boxes on top, you should make the platform a Kinematic Rigidbody instead of just a Collider without a Rigidbody.
3. You might want to have a Kinematic Rigidbody that is animated and have a real Rigidbody follow it using one of the available Joints.

### Static Colliders

Static Colliders are used for level geometry which does not move around much. You add a Mesh Collider to your already existing graphical meshes (even better use the Import Settings Generate Colliders check box). You can still move around Static Colliders, but if you move them around a lot, you might want to add a Kinematic Rigidbody. There are two reasons why you want to make a Static Collider into a Kinematic Rigidbody instead:

1. Kinematic Rigidbodies wake up other Rigidbodies when they collide with them.
2. Kinematic Rigidbodies apply friction to Rigidbodies placed on top of them

### Character Controllers

You use Character Controllers if you want to make a humanoid character. This could be the main character in a third person platformer, FPS shooter or any enemy characters.

These Controllers don't follow the rules of physics since it will not feel right (in Doom you run 90 miles per hour, come to halt in one frame and turn on a dime). Instead, a Character Controller performs collision detection to make sure your characters can slide along walls, walk up and down stairs, etc.

Character Controllers are not affected by forces but they can push Rigidbodies by applying forces to them from a script. Usually, all humanoid characters are implemented using Character Controllers.

Character Controllers are inherently unphysical, thus if you want to apply real physics - Swing on ropes, get pushed by big rocks - to your character you have to use a Rigidbody, this will let you use joints and forces on your character. But be aware that tuning a Rigidbody to feel right for a character is hard due to the unphysical way in which game characters are expected to behave.

If you parent a Character Controller with a Rigidbody you will get a "Joint" like behavior.

## Component Details

### Physics Control

• Rigidbody - Rigidbodies put objects under physics control.
• Constant Force - A utility component that adds a constant force to a rigidbody. Great for rockets and other quick functionality.