playMaker

Author Topic: Raycast ground detection goes wrong  (Read 819 times)

nFighter

  • Beta Group
  • Full Member
  • *
  • Posts: 154
    • View Profile
    • multiplayer adult fighting
Raycast ground detection goes wrong
« on: August 19, 2018, 08:46:50 AM »


Hello there! I have a very basic setup with a capsule collider and raycasting from it to the -Y. But when the collider is standing on the ground - raycast didn't see a ground. It start to works when I lift up the collider a very little bit, but stop when it fall back to the ground. Is it suppose to work this way or am I doing something wrong? What is the correct way to check if I am on the ground? Should I start the raycast not from the collider origin but from some offset point or maybe setup some thresholds in the physics settings?
indie developer of multiplayer adult fighting
http://nakedfighter3d.com

terri

  • Sr. Member
  • ****
  • Posts: 375
    • View Profile
    • terrivellmann.tumblr.com
Re: Raycast ground detection goes wrong
« Reply #1 on: August 19, 2018, 10:06:02 AM »
Maybe raycast from a bit higher?
I'd guess the start of the raycast is either right on or a bit lower than the floor collider's shell. Note that if the raycast is cast from inside a collider it will not hit