- Home /
Why Is My Zombie Not Colliding?
Hello, I am making a simple zombie shooter game with Unity! It has been working fine up until the zombie follows the player. It follows fine, but it just walks right through any objects! It has a mesh collider and so does the object it passes through! I am using the SmoothLookAt script and an always move forward script with it to make the zombie move.
The Always Move Forward Script:
function Update () { transform.Translate(Vector3.forward * Time.deltaTime); }
Answer by fafase · Aug 01, 2012 at 08:21 AM
Add a character controller. In your script, instead of moving your guy with transform, get the CC component and move it with it.
Use this to move your zombies:
http://docs.unity3d.com/Documentation/ScriptReference/CharacterController.Move.html
"Attempts to move the controller by motion, the motion will only be constrained by collisions. It will slide along colliders. CollisionFlags is the summary of collisions that occurred during the Move. This function does not apply any gravity."
Using the CC, you do not move with transform. Using transform just get theobject where you tell it to go without any care for physics or environement. That is why your zombies are going through. Add a CC to your zombie, fetch the component and guide your zombie using $$anonymous$$ove. Do not use transform anymore.
Answer by Nodrog26 · Aug 01, 2012 at 09:24 PM
Does this script not let me move my zombie manually? If so, can you put up a modified version?
Answer by Nodrog26 · Aug 01, 2012 at 09:12 PM
Does this script not just let me move my zombie manually with the arrow keys?
Answer by salad__fingers · Sep 05, 2012 at 10:55 PM
Put a capsule collider on it instead of the mesh colliders. Mesh colliders haven't worked (at least for me) recently.
Your answer
![](https://koobas.hobune.stream/wayback/20220613075015im_/https://answers.unity.com/themes/thub/images/avi.jpg)