My box goes through walls and other objects

Hi there,

So i have been working on the project and everything went smooth, then i found this issue when i was playing around with my game. Whenever i keep pressing one direction when my box already hit obstacles, and for about few seconds it ran through the object, sometimes even go through the wall, this isnt a big deal if i dont intentionally do it but im just wondering is this something wrong with my code or is it common, and everything does have collision. Thank you and your courses helped me a lot!

Hi Henry, welcome to the community. Check that the player has a ridged body. This is needed for the physics engine to detect collisions. Both objects need a collider that is not set to trigger and one of them needs a rigid body.

Yes both player abd the objects are having the collisions, as i went through the corse, rick said that this is a common issue since the game for now is not very detailed so there are only prototyped-collision for now. It should get better if the game gets detailed. Thank you for replying and helping me out!

Hi Henry,

Welcome to our community! :slight_smile:

Does this also happen with a slow player?

In this game, Rick uses a very simple solution to move the player game object: by manipulating its position directly. This way, we override any changes applied by the physics simulation. Since the physics simulation handles the collisions, it might be that a fast moving player is able to move through other colliders. For the sake of simplicity, Rick accepted this flaw when he created his game.

In the next section (Project Boost), Rick will show you how to use the Rigidbody to move a rocket. This way, faster moving game objects should be possible.

I hope this helped. :slight_smile:


See also:

1 Like

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

Privacy & Terms