Enable or disable collisions (ghost)
By default a character detects collisions and responds to that as expected like any dynamic rigid body. If for some reason this character needs to pass through objects then collisions must be disabled in some way. There are two ways you can achieve this:
Disabling the collider component.
Setting the character as kinematic
Disabling the collider component
The actor uses a ColliderComponent component which is a wrapper around a 2D/3D collider. Enabling/disabling this component will automatically enable/disable the collider.
CharacterActor.ColliderComponent.enabled = enableCollider;Setting the character as kinematic
Unlike a dynamic rigid body, a kinematic character is essentially considered by the physics engine as an infinite mass body that doesn't get affected by forces, meaning it can penetrate anything.
CharacterActor.IsKinematic = !enableCollisions;Last updated