Help Orienting Player for Wall Jumping

Currently making a Player Wall Jump Mechanic and one issue I’ve been having is properly orienting the player after they jump from a wall that they touched. I want the player to face in respect to the side of the wall that they are touching when they jump from it. I’ve tried a bunch of things that could potentially calculate what I need but I’ve had no luck so far.

In this clip, the first jump is ideally what I want but should be done no matter how the wall is oriented.

Snippet of my Mechanics Script:

--Physically move the player backwards
local hrp = character.HumanoidRootPart
local lookVectorX = currentWallJump.Value.Hitbox.CFrame.LookVector.X
local lookVectorY = currentWallJump.Value.Hitbox.CFrame.LookVector.Y
local lookVectorZ = currentWallJump.Value.Hitbox.CFrame.LookVector.Z
--local lookVectorX = hrp.CFrame.lookVector.X
--local lookVectorZ = hrp.CFrame.lookVector.Z
--local backPower = 800
--hrp:ApplyImpulse( * -backPower, 600, lookVectorZ * -backPower))
humanoid.WalkSpeed = 0
--hrp.CFrame *= CFrame.fromOrientation(0, math.rad(180), 0)
--hrp.CFrame *= CFrame.Angles(0, math.rad(180), 0)
--hrp.CFrame = CFrame.Angles(0, math.rad(180), 0)
--hrp.CFrame = * CFrame.fromEulerAnglesXYZ(0, math.rad(currentWallJump.Value.Hitbox.CFrame.LookVector.Y * -180), 0)
--hrp.CFrame = * CFrame.fromEulerAnglesXYZ(math.rad(currentWallJump.Value.Hitbox.CFrame.LookVector.X), math.rad(currentWallJump.Value.Hitbox.CFrame.LookVector.Y), math.rad(currentWallJump.Value.Hitbox.CFrame.LookVector.Z))
--hrp.CFrame = * CFrame.Angles(lookVectorX, lookVectorY, lookVectorZ)
print(lookVectorX, lookVectorY, lookVectorZ)
hrp.CFrame = * CFrame.Angles(lookVectorX, lookVectorY, lookVectorZ)
--humanoid.AutoRotate = true
--humanoid.PlatformStand = false
local backPower = 1500
hrp:ApplyImpulse( * -backPower, 800, lookVectorZ * -backPower))
humanoid.WalkSpeed = DEFAULT_WALKSPEED
humanoid.JumpPower = DEFAULT_JUMPPOWER

Looks like you will need to make use of the surface normal of the wall you are climbing on! Although I am afraid that the way you are currently doing this, you do not know the surface normal of the wall. The only solution I see, unless you switch over to using raycasts instead of those hitboxes, is to store a value inside each hitbox, telling the script which direction the player should face.

1 Like