Ho to Raycast Downward to Check for Collision in Unity | Easy C# Beginner Tutorial

preview_player
Показать описание

As we are using a Rigidbody in this Tutorial we used the FixedUpdate function to check whether we are grounded or not.

Road to 3K Subs!
________________

Drop a Like and Subscribe if you haven't already.

Thanks for watching.

Happy Coding!
Рекомендации по теме
Комментарии
Автор

6 years later and this is still helping new aspiring game devs like myself :)

JustJohn
Автор

Thank you, helped me in making my game :) (im a beginner)

mixagames
Автор

I wanted to make a custom wheel collider hope it works

jpdoshi
Автор

I would describe this more as check for is grounded than check for collision.

unaxeptable
Автор

thanx for your tutorial, it works perfect:)

mikehang
Автор

this doesn't seem to work for Unity2D
this is my code
private bool IsGrounded()
{
if (!Physics.Raycast(transform.position, -Vector2.up, distToGround + 1.0f))
{
Debug.Log(distToGround);
Debug.Log("not grounded!");
return false;
}
Debug.Log("grounede!");
return true;
}

nafish