Search code examples
c#unity-game-enginecollision-detection

Somethings wrong with my colliders (Unity Game Engine)


I have a character, that has a character controller attached to it I am using transform.position, transform.forward and transform.rotate to move with the 'wasd' keys, that all works fine.

However it will not collide with any sort of colliders, whether is be box colliders or mesh colliders. trigger works on my character, i.e. it can trigger an object to destroy if it passes through, but the colliders that are not set to triggers (like walls), don't block the player, the player just goes through them.

Any ideas?

Note: using C#, unity free version 4.5.1


Solution

  • Guys i figured out the problem, as the previous answer said i should not use transform with character controller, however there's no need to change any colliders, i still kept my character controller on my player, but rather i used controller.SimpleMove to move the character, that fixes the problem and i get to keep the character controller on my object (no need to add extra colliders or rigidbody to the player).

    http://docs.unity3d.com/ScriptReference/CharacterController.SimpleMove.html