Skip to content

RigidBodyComponent

Michele edited this page Oct 26, 2019 · 3 revisions

Description of the RigidBody Component

The RigidBodyComponent it's basically a collider object placed in the world. The RigidBody can be built on 3 different shapes:

  • BoxRigidBodyComponent
  • CapsuleRigidBodyComponent
  • SphereRigidBodyComponent

Types

The RigidBody can also be of three types:

  • static_rigidbody: it's a static collider that must be moved manually. Has "infinite mass and zero velocity".
  • kinematic_rigidbody: its velocity can be changed manually but its position is computed by the physics engine. Remember that it has "infinite mass".
  • dynamic_rigidbody: has non-zero mass, non-zero velocity determined by forces and its position is determined by the physics engine.

Change the material

You can edit a RigidBody to make it act differently in the world. Mostly important, you can edit: it's friction coefficient and it's bounciness.

Apply a force

The most important part of the RigidBody is that you can apply a force to it. You can use: apply_force_to_center(...) and apply_torqe(...) to apply a force on the RigidBody to make it move.

Remember that the dynamic RigidBody it's not conneted to a mesh by default. If you want to make an object move (for example the ball) you must call attach_to_mesh(...). This will update the mesh position with the physics engine result.