My Player runs through the walls

I have no idea why but my player does collide with the walls but it shows up as colliding repeatedly quite fast. The player then seems to phase through the walls quite easily haha. I have close to no idea what I am doing. Anyone else come across this problem?

1 Like

Hi GuttedSteve,

Have you already tried to set the Collision Detection of the player’s Rigidbody component to “Continuous”? Also test the player with a slower speed to see if the behaviour improves.


See also:

I set the speed waaay slower and that has stopped it. I would like it to be quicker in the future though so I am hoping that there are other ways to fix this as the lessons go on. Thanks for the reply :slight_smile:

In this section, we manipulate the transform.position directly and ignore the physics simulation. The physics simulation tries to “fix” our mistakes. This works fine if we move the player slowly but the physics simulation is not fast enough for our fast player. For this reason, our fast player is able to move through colliders.

The solution is not to manipulate the transform.position directly. Instead, we would have to tell the physics simulation to move our game object. We would do that with a Rigidbody method. If you want to challenge yourself, look up the AddRelativeForce method and read the example in the Unity API. Also look up Vector3.

If you find this too difficult, don’t worry. You’ll learn about it in the Project Boost section, which is the next section. Once you completed it, you could try to improve the code of your Obstacle Course game. :slight_smile:

1 Like

Thanks! I’m going to put a pin in this for maybe after I finish the project boost section. I felt like all of that was way too advanced for me. I am a complete beginner and not feeling confident YET! I will come back to it once I have developed my skills a bit more! :slight_smile:

That sounds like a good plan. I’m sure that my previous answer will not feel as confusing anymore once you completed this course. :slight_smile:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms