Created
March 31, 2024 15:53
-
-
Save AldeRoberge/021ce318700e1c6d5c52fe561b639e83 to your computer and use it in GitHub Desktop.
Allows to teleport a Kinematic Character Controller
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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