How do I make a marble jump but can't jump while in the air?

I want to achieve a marble that has a single jump but can’t jump in the air.

The issue with this is that FloorMaterial doesn’t work because the player is in a permanent PlatformStand state while as a marble, and the FloorMaterial in a PlatformStand is always air.

I have seen a few devforum posts about a marble that can jump, but they do not mention the fact that the marble can infinitely jump in the air without a debounce.

1 Like

Maybe constantly cast a ray pointing downwards from the marble.

When the player requests to jump, cast a ray below the marble. If the ray returns something (excluding the player inside), then allow it to jump.

2 Likes

This is what I do with my custom character controllers. If you want more accurate floor detection at the cost of some performance, you can use shapecasts (which seemed to be 2-3x slower when I tested them myself compared to raycasts).

Would I use a separate part or the marble itself?

Could you try GetTouchingParts and detect if that part is touching the bottom surface of the marble?

Add a denounce for each jump? That should work