I’ve been trying to replicate a move from Jujutsu Shenanigans that had the player jumping in an arc.
The problem is i can’t figure out how it was made, it cant be tweening or lerping because im pretty sure that’d make the player go through walls, either way i dont think those two should be used.
It also can’t be any physics based solutions.
I’m half sure it uses bezier curves somehow, but the move can be redirected in the direction the player is facing, which means each point of a bezier curve is generated before a player reaches the previous point, maybe it could use align position or linear velocity for the player to reach the points of that bezier curve, but i dont see how that would look as smooth as it does.
The positive part of the sin function could work as an arc, but from the video i think the arc is not exactly smooth like it.
Also If you mean changing the position of the player directly then I think thats not rly what is used here, as I said the move doesnt pass through objects and setting the position would do exactly that, you could use a raycast to prevent that but i think it’s unnecessary work
ah, I see what you mean. You probably do something similar to pathfinding and then recalculate the path if you come across an obstacle. You can see that the character was routed in one direction then when it encountered an obstacle the hitbox is large enough it switched directions.
Even though it seems like that at first, the redirection has nothing to do with the obstacle. The movement itself is supposed to be him swaying from side to side as does those hops.
I’m actually convinced it uses bezier curves now, the problem is how do you move a player along the curve without setting the position directly (to avoid phasing through walls
You can create this arc by using either RenderStep, Stepped, or task.wait() to control the event based on framerate, then use projectile motion equations.
v = v0 + gt – velocity is affected by acceleration/gravity
p = p + vt – position is affected by velocity
I will simplify things a lot and demo using a while loop and task.wait().
-- assume the enemy is grabbed here and you have network ownership of the enemy
-- this is a client script
local function noGroundBelow()
-- is there solid ground below your character? use raycast to check
end
local function bounceGrab(jumpVector: Vector3)
-- play jump VFX or ground slam here if second jump
while noGroundBelow() do
local dt = task.wait() -- you can obtain dt in .renderstep and .stepped too
jumpVector = jumpVector - Vector3.new(0,workspace.Gravity,0) * dt
myCharacter:PivotTo(myCharacter.PrimaryPart.CFrame + jumpVector * dt)
end -- this repeats until you hit the ground
end
bounceGrab(lookVector * 10 + upVector * 10)
bounceGrab(lookVector * 50 + upVector * 50) -- when you hit the ground, create another "jump" event
bounceGrab(lookVector * 100 + upVector * 100)
If you want more info on the arc and what the code means, search up “projectile motion”. Feel free to ask any questions below.
this absolutely works, but checking if the player landed right as the jump begins could cause problems, and it’d be better to trigger it like 1 second after the movement began. Also i wonder how do u slow down the movement? Do you just divide the delta time variable or is there some other way?
Oh yeah, sorry about that. That was a mistake on my end.
There’s 2 relevant mechanisms for ground checking that I know of
constantly check below you with a raycast. Only start checking when your jumpVector.Y is < 0, meaning you’re falling, you can also check upwards when jumpVector.Y is > 0, which lets you bounce off of ceilings. (ex: if jumpVector.Y < 0 then workspace:Raycast(charPosition, Vector3.new(0,-10 * dt, 0) end
check your fall direction. Instead of always checking below for the ground, you can check using your velocity as the direction instead. Raycast where you’re going to be and see if you hit something. (ex: workspace:Raycast(charPosition, jumpVector) )
Thank you,
Maybe its because of the built in physics or something from projectile motion, you will start falling (shooting raycasts) when the Y component of the jumpVector is somewhere half of it’s original Y component, not less than 0.
I wanted to know if theres a way to slow down the movement? I figured it’d have to do with delta time, but maybe there’s some other way? I’ve tried dividing the dt here and it did make it kind of slower, but it also increases the distance of the jump significantly enough. I’d like the distance jumped to be as close to the specified jumpVector distance as possible,
That shouldn’t happen. There is a mistake somewhere in your implementation. If you properly use the if statement jumpVector.Y < 0 you shouldn’t get that issue. In fact if you managed to obtain the half Y number, why not just use that to compare?
If you code it correctly, you should start raycasting when you reach the highest point in the jump.
Also make sure your character is anchored or you’re constantly setting their velocity before camera priority each frame (using .Stepped or BindToRenderStepped). You don’t want roblox physics to modify the character even more.
Anchoring the character worked in the Y component problem, but it doubled the distance the player jumps for some reason, but it doesnt really matter since it can be accounted for
I figured the only way to slow down the movement is adding a small, hundredth fraction of a millisecond to the task.wait
Thank you for helping!
Just realized that this has horrible replication issues ;( Probably has to do with the fact that the local script is updating player position way too frequently and the server just blocks it to prevent overload
Also noticed that it still phases through walls for some reason (it didn’t before), I could use raycasts to solve that but i dont want that, instead i just wanted the player to keep moving at the wall until he lands, without phasing through it
It seems that the solution was probably a mix of projectile motion and AlignPosition
The thing i’m doing differently is instead of moving the character im changing the align position’s position property to be that of where i want the player to be (note that im using OneAttachment mode on align position)
It’s replicates to other clients decently well and doesnt phase through walls, it does give some jitteriness to the player during the movement that is kind of weird but i guess it can be hidden by adding animations.
I don’t know what to mark as the solution, but i’ll mark mine, since it solves the problem i originally had