How can i detect that a Object hits the Ground?
Because when moving an Object, i need to chack in a special area, that it hits the ground.
Couple options. You could use
function OnCollisionEnter(col : Collision){
if(col.collider.CompareTag("ground")) isGrounded = true;
}
function OnCollisionExit(col: Collision){
if(col.collider.CompareTag("ground")) isGrounded = false;
}
You’d need to tag all your ground objects. Or just check by layer instead of tag. Another option is to use a Raycast which is how I usually do it.
Raycasting: Unity - Scripting API: Physics.Raycast
Also, I believe this measures distance from the center of the object. So you might want to have the “grounded” distance from the ground be the radius of your object.
If you need more help don’t be afraid to ask.
Oops, that double posted.
Check out this too
For extra performance, only set items that can collide with the ground in the matrix.