How can i detect character without humanoid is landed

Hello developers! i’m working with custom movement system. I’m doing game where you can be ball and completing obstacles. I did moving and jumping system. But i need to detect is Character(without humanoid) landed on ground. For preventing jumping on air. But i don’t know how can i do this. Can somebody please help me?

3 Likes

Here, this article will give basic explanation on raycasting.

Do a loop where you raycast down, with the ray length that is half size of your ball character.
For RaycastParams:

local groundRaycast = RaycastParams.new()
groundRaycast.FilterDescendantsInstances = {yourBallCharacter, anythingInvisible}
groundRaycast.FilterType = Enum.RaycastFilterType.Exclude

If your raycast returned something, you can allow jump. I also recommend adding debounce for jumping too.

2 Likes

How can i do this? sorry, i can’t understand raycasting also i’m not good in raycasting.

1 Like

https://youtu.be/Wl3mXFlRPo4 This video is quick and helpful. Also some people don’t realize what a ray is .——> a line segment.—-. is different cus it has endpoints which might help to grasp the concept.

2 Likes

Thank you but still didn’t understand how i’m gonna detect player landing with raycasting system.

Anybody can help me? this is really affecting to my project…

You could do checking raycast for which ground it’s about to be on every heart beat (task.wait) and then replace it with if the player touches the ground. I haven’t done try this, but you can try the pseudocode. It’s not convenient for performance though, I think.

Thanks for helps guys but i solved problem myself. And it works successfully!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.