#how can i get a velocity in a direction like this?
1 messages · Page 1 of 1 (latest)
there are a lot of ways in which a wall jump can be implemented, you gotta be more specific in how you want it to work. is this based on any existing games?
is it always in the same relative direction?
uhh
itll change depending on what side of the wall ur on
if the wall is to the left of u you'll get launched away to the right
i can show the current code i have if u want
it currently goes upward and sideways away from the wall
but it doesnt have the extra forward velocity in the screenshot
actually lemme just get the full thing
hold on i forgot how to format as code
local rightwall = workspace:Raycast(
HRP.Position,
HRP.CFrame.RightVector * walljumpdist,
wallparams
)
local leftwall = workspace:Raycast(
HRP.Position,
-HRP.CFrame.RightVector * walljumpdist,
wallparams
)
local wallhit = rightwall or leftwall
local wallside = if rightwall then "RightWall" else "LeftWall"
if wallhit and wallhit.Instance:HasTag("Wall_") then
touchingwall = true
wallGUI.Text = wallside
else
touchingwall = false
wallGUI.Text = "no wall"
end
UIS.JumpRequest:Connect(function(input) --walljump
if WJdebounce then return end
WJdebounce = true
task.delay(0.1, function()
WJdebounce = false
end)
if candj == true then
if humanoid:GetState() == Enum.HumanoidStateType.Freefall then
if sliding == false then
if touchingwall == true then
print(wallhit.Position)
local wjbv = Instance.new("BodyVelocity")
local raystart = HRP.CFrame.Position
local raydirection = wallhit.Position
local rayresult = workspace:Raycast(raystart, raydirection, wallparams)
wjbv.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
print(rayresult.Normal)
print("WJ attempted")
wjbv.Velocity = (rayresult.Normal * humanoid.WalkSpeed) + (HRP.CFrame.UpVector * 50)
wjbv.Parent = HRP
task.wait(0.1)
wjbv:Destroy()
candj = false
end
end
end
end
end)
end)```
there]
now its code
and here is a recording
of how it currently looks
have you fixed it?
** You are now Level 2! **
I figured it out