Sunday, July 10, 2016

unity - How to solve the ground check problem?


I noticed a problem in Unity's third person controller's ground check.


The ground check should detect whether or not the player is standing on the ground. It does so by sending out a ray beneath the player.


However, if the player stands on top and in middle of two boxes and there is a space between these boxes, then the ray shoots into the gap and the player thinks he is not in contact with the ground, which looks like this:



enter image description here


enter image description here


I am unable to move. You can clearly see that the ray is in the gap and thus the player animator airborne blend tree is active.


What is the best way to solve this problem?


I was thinking of shooting multiple rays, from the same origin but with different angles. And OnGround should only be true, if X% of these rays hit the "ground". Or is there a better way?




No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...