Hi, so in my project I’m working on using grappling hooks to maneuver around trees however whenever my character collides with a tree, it spins out. This causes my camera to not be aligned with the player and my movement gets all messed up.
Below is what I’ve tried to use to fix the issue however it doesn’t seem to work.
void OnCollisionEnter(Collision collider) {
if (collider.gameObject.transform.tag == "Ground") {
Debug.Log("hit ground");
isGrounded = true;
}
if (collider.gameObject.transform.tag == "tree") {
Debug.Log("hit tree");
rigidbody.rotation = Quaternion.identity;
}
}
I was just wondering whether there was any way to stop this rotation on collision.
Thanks