- Home /
Question by
TheArgo · May 28, 2021 at 09:21 PM ·
offsetstepcontrollercolliderhit
How to make Step Offset 0 when Character Controller makes contact with certain tag?
I want to prevent the first person player from climbing on certain boxes with the tag "boxes". I have tried to use the OnControllerColliderHit but the controller's step offset does not go to 0. What am I missing?
private void OnControllerColliderHit(ControllerColliderHit hit)
{
Rigidbody body = hit.collider.attachedRigidbody;
if (hit.gameObject.CompareTag("boxes"))
{
m_CharacterController.stepOffset = 0f;
}
else
{
m_CharacterController.stepOffset = 0.18f;
}
}
Comment
Your answer
Follow this Question
Related Questions
Step Offset for Rigidbody Character 1 Answer
How do I offset the scaling center for a cube 1 Answer
gun sway, gun swing, gun offset 0 Answers
Look to the side-Scripting Problem 2 Answers
SetIKPosition offset 1 Answer