2 questions about the head collider functionality

For some reason, my guy is going through the ground rather than the head collider bumping the level sprite shape collider (It seems to be working randomly. It worked earlier)



Also, how does Unity know the head collider is the one that’s going to make the person lose? Is it because we made the circle collider “is trigger” but not the snowboard?

2 Likes

Hi,

Actually, Rick’s Barry should have dived into the ground instead of bouncing off. In later videos, you can see, that he doesn’t bounce anymore. Rick suspects that the surface effector made the head bounce in this case. Sometimes, there are undesired side-effects, and since we didn’t write the Collider2D classes or the surface effector class ourselves, we cannot prevent those side-effects.

Yes, exactly. The trick is that we have only one trigger collider on the player: the ‘head’ collider. And since it is the only trigger collider, OnTriggerEnter2D gets called only when the ‘head’ collider is involved in a collision event.


See also:

3 Likes

thank you!

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

Privacy & Terms