Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save AldeRoberge/021ce318700e1c6d5c52fe561b639e83 to your computer and use it in GitHub Desktop.
Save AldeRoberge/021ce318700e1c6d5c52fe561b639e83 to your computer and use it in GitHub Desktop.
Allows to teleport a Kinematic Character Controller
// Get the ExampleCharacterController
if (_kccMotor.CharacterController is not ExampleCharacterController exampleCharacterController)
{
Debug.LogError("ExampleCharacterController is null");
return;
}
// Disable
exampleCharacterController.enabled = false;
// Set position
_kccMotor.SetPositionAndRotation(pos.position, pos.rotation);
_kccMotor.BaseVelocity = Vector3.zero;
// Re-enable
exampleCharacterController.enabled = true;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment