Quantcast
Channel: Questions in topic: "below"
Viewing all articles
Browse latest Browse all 6

Detect if there's collision from below? (box collider)

$
0
0
Hi, I'm making a sidescroller controller and cant get pass the jumping. I need to know when the player is on ground. I know I can raycast but it's not working right with just one raycast, and I can't figure out working with multiple rays. After a bit of googling and searching I got this far. function OnCollisionStay(coll : Collision) { if(coll.contacts.Length > 0) { var contact = coll.contacts[0]; if(Vector3.Dot(contact.normal, Vector3.up) > 0.5) { onGround = true; } } } But as it works when on ground, I don't know how to check when its off ground. I tried a bunch different else if's but none worked. Any suggestions? Or a better way for doing jumping? Thank you!

Viewing all articles
Browse latest Browse all 6

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>