I’m making a wallrun system, I’m trying add a “jump off” mechanic that will make you jump diagonally away from the wall (forward and to the opposite side of the wall)
Issue I’m having is applying a velocity at a diagonal angle from the velocity I’m already travelling in
I guess I could use the lookVector of the hrp and add the rightVector normalizing depending on the side? Though that seems a bit worse as an option
Below is what I’ve tried so far
--Detect Which Side You're On
local left = rayModule.LeftRay(char, 4)
local right = rayModule.RightRay(char, 4)
--Jump off function
local function jumpOffVelocity(ray, directionNormalize)
local lookVector = ray.Normal * 100 * directionNormalize
local vel = CFrame.Angles(math.rad(45),0,math.rad(45)):VectorToWorldSpace(lookVector)
hrp.AssemblyLinearVelocity = Vector3.new(vel.X, jumpOffPower, vel.Z)
end
--Jump off according to direction based on wall currently on
if left then
jumpOffVelocity(left, 1)
elseif right then
jumpOffVelocity(right, -1)
end