Double-jump check

I wanted to make a double jumping system that when a player is close enough to a basepart and is not facing away from it he can double jump.

What I mean by not facing away from it might be a little confusing, but I will give some examples of what I mean: (basically an angle threshold)


^
able to double-jump

^
able to double-jump


^
unable to double-jump

I used to use a part as a hitbox, but I wouldn’t say I like the approach, and it’s tiresome.

How can I use some other methods like ray casts or dot products to achieve that? (or any other method I don’t know)

Iterating over every basepart in the workspace won’t seem good to me, though I put every player character in a folder called Characters in the workspace so that might be used as filter descendants if required.

Any help or advice would be appreciated!

1 Like

I think ray casts would be the solution id go for, you can use the lookvector of the humanoid root part for casting straight Infront, and also to angles to either side using the frame.angles method

The only problem I can see this having is if for whatever reason an object manages to fit in-between rays it won’t count, similarly if it is above or below, which you wouldn’t need a double jump if it below but limits your usage so you can’t have overhangs.

One possible solution to solve narrow objects fitting in-between rays could be to cast a ray from the proposed end points of all the rays and see if it hits, but again if the object is thin, this wouldn’t count i.e a pole.

Either way give it a go and see how you like the result I can’t imagine it’d take long to do

1 Like

I tried to test the values I desired. This works fine thanks! I thought of this at first but felt there might be better methods. That shall work for it thanks.

1 Like

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