0% found this document useful (0 votes)
125 views5 pages

Unity - Manual: Introduction To Rigid Body Physics

Uploaded by

5zdt7tt2f2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
125 views5 pages

Unity - Manual: Introduction To Rigid Body Physics

Uploaded by

5zdt7tt2f2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Unity - Manual: Introduction to rigid body physics 16/11/24, 12:20 AM

unity.com

Search manual... Version: Unity


Unity 66 (6000.0) Language : English
English

Unity Manual Manual Scripting API


Physics / Built-in 3D Physics /
Rigidbody physics /
Unity 6 User Manual
Introduction to rigid body physics
What's new in Unity
Install and upgrade
Packages and feature sets
Get started with Unity
The Unity Editor
Working in Unity
Introduction to rigid
World building body physics
Multiplayer In real-world physics, a rigid body is any physical
Animation body that does not deform or change shape under
physics forces. The distance between any two
Physics
given points of a rigid body remains constant in
Built-in 3D Physics time, regardless of external forces exerted on it.

Character control To simulate physics-based behavior such as


Rigidbody physics movement, gravity, collision
collision, and joints, you need
to con>gure items in your scene
scene as rigid bodies.
Introduction
Introduction to
to rigid
rigid body
body
To con>gure GameObjects
GameObjects as rigid bodies in
physics
physics
Unity’s PhysX system, you can assign them the
Con>gure Rigidbody Colliders
Rigidbody component. The Rigidbody component is
Apply constant force to a represented in the API by the Rigidbody class.
Rigidbody
Apply interpolation to a
Rigidbody
Rigid body GameObjects
Rigidbody component reference
with physics-based
Constant Force component
movement
reference In Unity, a Rigidbody component provides a
Collision physics-based way to control the movement and
Joints position of a GameObject. Instead of the Transform
properties, you can use simulated physics forces
Articulations

https://docs.unity3d.com/Manual/RigidbodiesOverview.html Page 1 of 5
Unity - Manual: Introduction to rigid body physics 16/11/24, 12:20 AM

Ragdoll physics and torque to move the GameObject, and let the
Cloth physics
physics engine
engine calculate the results.

Multi-scene physics
In most cases, if a GameObject has a Rigidbody,
Physics Debug window reference you should use the Rigidbody properties to move
Physics Pro>ler module the GameObject, instead of the Transform
properties. The Rigidbody properties apply forces
Lighting
and torque from the physics system, which change
Materials and shaders
the GameObject’s Transform; if you then change
Visual effects the Transform directly, Unity cannot correctly
Rendering calculate the physics simulation, and you might see
unwanted behavior. This is particularly true of rigid
Audio
bodies with Joints.

Unity handles physics-based movement globally,


not locally. When a GameObject with a Rigidbody
moves via physics-based movement, it moves
independently of any parent or child GameObject. A
child GameObject that has a Rigidbody still uses its
parent GameObject to de>ne its local position for
initialization, but Unity calculates its physics-based
movement in global space.

To control a Rigidbody via script, the primary


classes are AddForce (to add forces to a
GameObject) and AddTorque (to apply torque to a
GameObject).

Rigid body GameObjects


without physics-based
movement
There are some cases where you might want the
physics system to detect a GameObject, but not to
control it. For example, you might want Colliders to
detect a GameObject, but you intend to control that
GameObject’s movement and position via its
Transform.

Movement in Unity that is not physics-based is


called kinematic
kinematic motion
motion. The Rigidbody

https://docs.unity3d.com/Manual/RigidbodiesOverview.html Page 2 of 5
Unity - Manual: Introduction to rigid body physics 16/11/24, 12:20 AM

component has the property Is


Is Kinematic
Kinematic which,
when enabled, de>nes the attached GameObject as
non-physics-based, and removes it from the control
of the physics engine. This allows you to move it
kinematically via the Transform without Unity’s
physics simulation calculations overriding the
changes.

A kinematic Rigidbody can apply physics-based


force to physics-based Rigidbody GameObjects, but
does not receive physics-based force. For example,
a kinematic Rigidbody can collide with and “push” a
Rigidbody that has physics-based movement, but a
Rigidbody with physics-based movement cannot
“push” a kinematic Rigidbody.

If you use a Joint to attach a kinematic Rigidbody


to a non-kinematic Rigidbody, the Joint cannot
exert forces to move the kinematic Rigidbody. It
can only ever move the non-kinematic Rigidbody.
However, you can still move the kinematic
Rigidbody via the Transform, and the Joint can
adjust the pose of the non-kinematic body to
satisfy the joint limits.

Rigidbody optimization
When a Rigidbody moves at a slower speed than
the Sleep
Sleep Threshold
Threshold (see the Physics Project
Settings), Unity sets the Rigidbody to “sleep”, which
means that the physics system does not include it
in physics calculations. When a sleeping Rigidbody
receives a collision or force, Unity “wakes up” the
Rigidbody and continues to include it in physics
calculations.

By default, the sleeping and waking of a Rigidbody


component happens automatically. However, you
can also control this behavior yourself via script, via
the methods Rigidbody.Sleep and
Rigidbody.WakeUp .

https://docs.unity3d.com/Manual/RigidbodiesOverview.html Page 3 of 5
Unity - Manual: Introduction to rigid body physics 16/11/24, 12:20 AM

A Rigidbody might fail to wake up in response to


movement and collisions from static colliders (that
is, colliders without a Rigidbody) that are moving
via the Transform
Transform position instead of the physics
system. This is particularly likely if the physics
system can no longer detect the static collider. If
this happens, you can use Rigidbody.WakeUp to
wake up the sleeping Rigidbody.

For more information on how the PhysX physics


system handles sleeping, see the NVIDIA PhysX
SDK Rigidbody Dynamics documentation on
Sleeping .

Did you >nd this page useful? Please give it a


rating:

Report a problem on this page

Copyright ©2005-2024 Unity Technologies. All rights

reserved. Built from 6000.0.29f1 (eee40ee901bc). Built

on: 2024-11-14.

Tutorials Community Answers Knowledge

Base Forums Asset Store Terms of

use Legal Privacy Policy Cookies Do Not

https://docs.unity3d.com/Manual/RigidbodiesOverview.html Page 4 of 5
Unity - Manual: Introduction to rigid body physics 16/11/24, 12:20 AM

Sell or Share My Personal Information

Your Privacy Choices (Cookie Settings)

https://docs.unity3d.com/Manual/RigidbodiesOverview.html Page 5 of 5

You might also like