Control of an object's position through physics simulation.
Adding a Rigidbody component to an object will put its motion under the control of Unity's physics engine. Even without adding any code, a Rigidbody object will be pulled downward by gravity and will react to collisions with incoming objects if the right Collider component is also present.
The Rigidbody also has a scripting API that lets you apply forces to the object and control it in a physically realistic way. For example, a car's behaviour can be specified in terms of the forces applied by the wheels. Given this information, the physics engine can handle most other aspects of the car's motion, so it will accelerate realistically and respond correctly to collisions.
In a script, the FixedUpdate function is recommended as the place to apply forces and change Rigidbody settings (as opposed to Update, which is used for most other frame update tasks). The reason for this is that physics updates are carried out in measured time steps that don't coincide with the frame update. FixedUpdate is called immediately before each physics update and so any changes made there will be processed directly.
A common problem when starting out with Rigidbodies is that the game physics appears to run in "slow motion". This is actually due to the scale used for your models. The default gravity settings assume that one world unit corresponds to one metre of distance. With non-physical games, it doesn't make much difference if your models are all 100 units long but when using physics, they will be treated as very large objects. If a large scale is used for objects that are supposed to be small, they will appear to fall very slowly - the physics engine thinks they are very large objects falling over very large distances. With this in mind, be sure to keep your objects more or less at their scale in real life (so a car should be about 4 units = 4 metres, for example).
angularDrag | The angular drag of the object. |
angularVelocity | The angular velocity vector of the rigidbody. |
centerOfMass | The center of mass relative to the transform's origin. |
collisionDetectionMode | The Rigidbody's collision detection mode. |
constraints | Controls which degrees of freedom are allowed for the simulation of this Rigidbody. |
detectCollisions | ¿Debería estar habilitada la detección de colisiones? (Por defecto siempre está habilitada). |
drag | The drag of the object. |
freezeRotation | Controls whether physics will change the rotation of the object. |
inertiaTensor | The diagonal inertia tensor of mass relative to the center of mass. |
inertiaTensorRotation | La rotación del tensor de inercia. |
interpolation | Interpolation allows you to smooth out the effect of running physics at a fixed frame rate. |
isKinematic | Controla si las físicas afectan al rigidbody. |
mass | La masa del rigidbody. |
maxAngularVelocity | The maximimum angular velocity of the rigidbody. (Default 7) range { 0, infinity }. |
maxDepenetrationVelocity | La velocidad del rigidbody en el punto worldPoint en el espacio global. |
position | La posición del rigidbody. |
rotation | La rotación del rigidbody. |
sleepThreshold | The mass-normalized energy threshold, below which objects start going to sleep. |
solverIterationCount | Allows you to override the solver iteration count per rigidbody. |
useConeFriction | Force cone friction to be used for this rigidbody. |
useGravity | Controls whether gravity affects this rigidbody. |
velocity | El vector velocidad del rigidbody. |
worldCenterOfMass | The center of mass of the rigidbody in world space (Read Only). |
AddExplosionForce | Aplica una fuerza al rigidbody simulando el efecto de una explosión. La fuerza de la explosión disminuirá linearmente según aumente la distancia al rigidbody. |
AddForce | Aplica un esfuerzo de torsión al Rigidbody. |
AddForceAtPosition | Aplica una fuerza force en una posición position. Como resultado esto aplicará un esfuerzo de torsión y una fuerza en el objeto. |
AddRelativeForce | Aplica al rigidbody una fuerza relativa a su sistema de coordenadas. |
AddRelativeTorque | Aplica al rigidbody una fuerza relativa a su sistema de coordenadas. |
AddTorque | Aplica un esfuerzo de torsión al Rigidbody. |
ClosestPointOnBounds | El punto más cercano al cubo delimitador de los Colliders adjuntos. |
GetPointVelocity | La velocidad del rigidbody en el punto worldPoint en el espacio global. |
GetRelativePointVelocity | La velocidad relativa del rigidbody en el punto relativePoint. |
IsSleeping | ¿Está "durmiendo" el rigidbody? |
MovePosition | Mueve el rigidbody a la posición position. |
MoveRotation | Rota el rigidbody con una rotación rotation. |
ResetCenterOfMass | La masa del rigidbody. |
ResetInertiaTensor | El tensor de inercia se rota con inertiaTensorRotation. |
SetDensity | Sets the mass based on the attached colliders assuming a constant density. |
Sleep | Obliga a un rigidbody a "dormir" al menos durante un frame. |
SweepTest | Tests if a rigidbody would collide with anything, if it was moved through the scene. |
SweepTestAll | Igual que Rigidbody.SweepTest, pero devuelve todos los impactos. |
WakeUp | Obliga a un rigidbody a "despertarse". |
OnCollisionEnter | OnCollisionEnter se llama cuando el Collider o Rigidbody entra en contacto con otro Collider o Rigidbody. |
OnCollisionExit | OnCollisionExit se llama cuando el Collider o Rigidbody ha dejado de tocar otro Collider o Rigidbody. |
OnCollisionStay | OnCollisionStay is called once per frame for every collider/rigidbody that is touching rigidbody/collider. |
gameObject | The game object this component is attached to. A component is always attached to a game object. |
tag | El tag de este game object. |
transform | The Transform attached to this GameObject (null if there is none attached). |
hideFlags | Should the object be hidden, saved with the scene or modifiable by the user? |
name | El nombre del objeto. |
BroadcastMessage | Llama al método denominado methodName de todos los MonoBehaviour en este game objecto en cualquiera de sus hijos. |
CompareTag | ¿Este game object está etiquetado con tag? |
GetComponent | Devuelve un componente de tipo type si el game object tiene a alguno adjuntado, o null si no lo tiene. |
GetComponentInChildren | Returns the component of Type type in the GameObject or any of its children using depth first search. |
GetComponentInParent | Returns the component of Type type in the GameObject or any of its parents. |
GetComponents | Returns all components of Type type in the GameObject. |
GetComponentsInChildren | Returns all components of Type type in the GameObject or any of its children. |
GetComponentsInParent | Returns all components of Type type in the GameObject or any of its parents. |
SendMessage | Llama al método denominado methodName en cada MonoBehaviour de este game object. |
SendMessageUpwards | Llama al método denominado methodName en todos los MonoBehaviour de este juego y en todos los ancestros del behaviour. |
GetInstanceID | Returns the instance id of the object. |
ToString | Devuelve el nombre del objeto. |
Destroy | Elimina un gameobject, componente o asset. |
DestroyImmediate | Destroys the object obj immediately. You are strongly recommended to use Destroy instead. |
DontDestroyOnLoad | Makes the object target not be destroyed automatically when loading a new scene. |
FindObjectOfType | Devuelve el primer objeto activo cargado de tipo type. |
FindObjectsOfType | Devuelve una lista de todos los objetos activos cargados de tipo type. |
Instantiate | Devuelve el nombre del objeto. |
bool | ¿Existe el objeto? |
operator != | Compares if two objects refer to a different object. |
operator == | Compares two object references to see if they refer to the same object. |