- Home /
Collider not responding to my actions
Hi there, im making a game where my character slides ( rotation 90 deg ) everytime I press right Click.
The problem is that my collider dont follow my action. The collider stays straight up. I want the collider to rotate just like my character.
I have been searching and searching but nothing. I tried lot of things..... Is there a way to solve this problem.
Thx
I don't think there is a way to change the orientation of the collider for the built in character controller, you could in script try to make it smaller when you are sliding i.e. adjust the radius height and center values http://unity3d.com/support/documentation/ScriptReference/CharacterController.html
Answer by jaised · Feb 25, 2012 at 06:11 AM
If you want your collider to perform with Physics you need to add the Physics elements to them. I'm not going to write your code, but here is what you need to do.
If using CharacterController: Apply a RigidBody to whatever you want to be interacted with, and when your collider runs into that RigidBody, the ControllerColliderHit() will be called. In there apply a force to the rigidbody.
If using RigidBody: Apply a RigidBody to whatever you want to be interacter with, and since your collider is a rigidBody as well, the Physics engine should take care of the rest.
You can modify which axes can be frozen if you don't want them to be rotated about. Hopefully this points you in the right direction:
http://unity3d.com/support/documentation/Manual/Physics.html
http://unity3d.com/support/documentation/ScriptReference/Rigidbody.html
http://unity3d.com/support/documentation/ScriptReference/ControllerColliderHit.html