[SOLVED] Is there any way to get the collisions of an entity on demand? (Good way to to detect ground collision for jumping)

Right, so there is probably no universal approach and the jump mechanic is usually tailored to the game. From what I read in your description, your issue with the raycast was that it doesn’t report the collision, when the player is standing on the edge. You can mitigate it by using a convex sweep test of the physics engine, instead of raycast. If your character has a cyllinder collision shape, you can cast a sphere shape downwards to test for ground touch.

I made a convex cast extension to make it easier to do convex shapes collision tests:

Edit:
There is also a way for the collider to continuously track the collision with a rigidbody. I made an example a while back, but it hasn’t been battle tested, so might have bugs/issues:
https://playcanvas.com/project/718607/overview/oncollisionstay

1 Like