Open EloiStree opened 1 week ago
🤖 In Unity, Kinematic refers to a type of object behavior in the physics system, typically applied to Rigidbody components. When you set a Rigidbody to kinematic, you are telling the physics engine to treat the object differently from dynamic objects, which are affected by forces such as gravity, collisions, and other physical interactions. Kinematic objects are not influenced by the physics engine but can still affect other objects.
Here’s what happens when you mark a Rigidbody as kinematic:
transform
(i.e., changing position or rotation directly) or using functions like Rigidbody.MovePosition()
and Rigidbody.MoveRotation()
.In Unity, you can set a Rigidbody to kinematic either through the Inspector window or in code.
In Inspector:
In Code:
Rigidbody rb = GetComponent<Rigidbody>();
rb.isKinematic = true;
If you have a character controlled via keyboard input, you typically want precise movement and don’t want the character to be knocked over by small collisions or affected by gravity when jumping or falling. Setting the character’s Rigidbody to kinematic lets you manually control the character’s position, while still allowing them to interact with the physics system (like pushing other objects or triggering collision events).
In summary, using kinematic Rigidbodies is ideal when you need direct control over an object’s movement and rotation, rather than relying on physics simulations, while still allowing interactions with other physical objects in your scene.
Dynamic vs static vs Kinematic https://youtu.be/xp37Hz1t1Q8