- Home /
Character Collider doesn't collide with other Colliders
Hey there folks,
i got a little problem. I use a 2D Texture (with ex2D) as the player. That player has a CharacterController attached (for movement). The level has got some flat cubes (Box Collider). IF my character walks ON these cubes, everythings allright, he walks on them and doesn't fall, also the bool Method .isGrounded is set to "true". BUT as soon the Character walks IN a Box (in order to test the collision i put some random cubes on his way), he doesn't collide with the boxes, but goes just through them. But that shouldn't happen. He should just stop and isn't allowed to move any further.
Did i do something wrong or is there a problem with Character Collider and the other sorts of Colliders?
Answer by BTStone · May 18, 2012 at 03:51 PM
Actually i am using the translate-Method. I guess that's my mistake? The walls are not triggers and not layers colliding with the player's layer, that's for sure.
I looked up the .Move/SimpleMove-Methods at the Script-Reference(http://unity3d.com/support/documentation/ScriptReference/CharacterController.Move.html), it says at a certain point:
moveDirection = Vector3(Input.GetAxis("Horizontal"), 0,
Input.GetAxis("Vertical"));
moveDirection = transform.TransformDirection(moveDirection);
moveDirection *= speed;
The point is, i am scripting for an 2D Plattformer-Game on iOS and i am using touches, so i can't use .GetAxis in order to do anything, i have to use my touches. How do i have to change the code in order to get it to work?
(Sry for the bad english, not a native speaker.)
Yep, translate will modify the transform's matrix no matter what's around. $$anonymous$$ove / Simple$$anonymous$$ove apply a force in the direction you give them, which means the physic engine will simulate the movement to check if a collision occures before actually doing it.
As for your iOS question, I've never coded for mobile platform, but I guess it has something to do with the Touch struct.
Allright, so i'll dig in the Touch-struct. Thank you for explaining!
Answer by Berenger · May 18, 2012 at 03:25 PM
Are you using SimpleMove or Move to make your character walks ? Are you sure the walls aren't triggers and that they are not on a layer not colliding with the player's layer ?
Your answer
Follow this Question
Related Questions
OnCollisionEnter not working 1 Answer
add camera collision without CharacterController 1 Answer
OnCollisionEnter Push Object Problem 0 Answers
How not to penetrate the walls? 3 Answers
How do I detect when two CharacterControllers collide? 0 Answers