Hi guys im using this method to do a ground check on a 2d demo i made and it works well.
public bool isGrounded()
{
RaycastHit2D raycast2D = Physics2D.BoxCast(playerStandingCollider.bounds.center, playerStandingCollider.bounds.size, 0f, Vector2.down, .1f, Ground);
return raycast2D.collider != null;
}
I’m trying to make something similar for a 3D model character, but when i remove 2D off everything, Ground gives me an error. Tried reading the documentation for RayCastHit but couldnt see how to structure it the same as the 2D version. Please help
There’s SO many examples of this on Youtube dude…
Here’s two more examples:
Welcome!
First, please use code tags: Using code tags properly when you post code.
But secondly, what is weird is that this is the second time recently that I’ve seen this code reported broken.
I went and investigated and what appears to have happened is that Unity’s example used to work back on earlier versions of Unity.
BUT… on more recent Unity versions, I concur with you that it presently does NOT work reliably, at least for jumping.
If I had to guess why, I believe it is their two sepa…
https://www.youtube.com/watch?v=t0oN-PFXZEM
Gist Link
After some interest in an old post here , I spent the weekend frankensteining snippets of code to make a single script FPCC that could be used like the FPCC from Unity 4~5, including the crouch and run from Aldo, and I also added farcry sliding. There is a Menu Item function to easily create and configure a new FPCC object. Otherwise very easy to set up, it only requires a layer to exclude itself from sphere/raycasts. There is a check to …
1 Like