ObstacleCourse Collision problem

Hey guys,

The problem I am having is when I creep the ball forward to the wall before I hit the wall I get the print “You’ve bumped into a thing this many times:”. How do you fix this?

I fixed it by turning off the mesh collider on the plane. I removed the walls and realized I was still getting the error while on the plane.

Update: I had to turn on the mesh collider because the block would just fall through the world. I ended up setting a tag to plane and adding that tag to the conditional if that handles the score.

I also would like to note that when i pressed the sphere in between two corners, the sphere would begin to move around on its own. I fixed that by setting the angular drag to 4 (anything other than 0).

Hi John,

Welcome to our community! :slight_smile:

Good job on analysing the problem. You are right. The player very likely collides with the plane collider on start. This is the expected behaviour because the code gets executed whenever we collide with another collider. We do not check if the other collider belongs to a wall.

In one of the next videos, Rick is going to show you how we can add restrictions to our code, so we increase hits only if a certain condition is true. Maybe you’ve already heard of if-statements. That’s what we are going to use to solve this problem. Please keep watching. :slight_smile:

Regarding the sudden movement, it is/was probably caused by the physics simulation, which is a simulation, not the real world. For this reason, we are able to move a bit into other colliders, and the physics simulation pushes us back, which causes movement. Since we don’t use any Physics Materials, the plane is like ice. If the player gets pushes, he moves like on ice. Setting the angular drag to 4 was a good idea because it slows that movement down.


See also:

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

Privacy & Terms