Advanced return axe trajectory

Hey developers,
I’m trying to figure out how to solve a position or cframe for my axe’s trajectory using bézier curves with 3 points, 2 of them I currently have is the Axe & Goal position.
(Axe is the start position, while the goal is the end position)

The point I’m missing is a position over an obstacle, which is the middle point for my bézier curve.

I couldn’t find a solution besides trying to cast a few rays which could be expensive if the part is large.

Sorry if this isn’t enough information of the issue.

1 Like

If the axe is thrown you can try mouse.Target.Position + Vector3.new(0 , 0 , 5) or something like that, thats my best guess from what i understood

I’m trying to figure out which side the axe should go over to return to it’s user, raycasts might solve this because of the position and normal, but will be hard to calculate which side is the shortest/smallest

1 Like

I dont really use raycastimg so idk a little about these type of stuff, but try calculating x and y values and find the smaller ones?

You can use part position and character position to see which side is he closer to, that isn’t my type of scripting, if i knew anything ill tell you!

1 Like

I think this solution is dumb but this is what I can think of, (Apologies for bad writing)
one raycast will get the obstacle, while the other raycasts is to check the sides of the obstacle,
if the raycast doesn’t hit anything then it would be considered as “air” which is a positive,
otherwise will repeat the process of casting a few rays but different positions over the obstacle to check for any parts beside it
once i get any results, i will use the raycast’s normal and position with a little offset relatively to it’s obstacle


Sorry if my illustration is bad, I’m bad at drawing

Thank you for trying to help me, I really appreciate it!

1 Like

Note : I could be completely wrong here.

I think your doing a bit too complicated I THINK you can just get the difference in position and the direction using Magnitude and Unit and see whether the player is in the right or left side so basically use CFrames you can check using ToObjectSpace() and if the angle is below zero means he is on the right side (or the opposite so check it yourself)
and again this could be COMPLETELY wrong as i have never done this type of scripting

1 Like