Creating Fluent & Dynamic Vaulting

Hi!

I’m currently working on a game that’s supposed to have fairly limited mobility in terms of jumping, as I plan on replacing the contemporary jumping feature with the ability to scale walls. I’ve been thinking about ways to do this in a dynamic manner through raycasting based on spacebar input and checking if the object is the proper height to vault over.

The one case I’m having difficulty solving is vaulting over “fences,” which encompass any object that is taller than your character. How would I properly check if the vaulting path is obstructed by another part and how would I move the character up, over, and allow them to drop?

I’m not asking for any code, just a general flowchart-like explanation of how to do this efficiently where it feels responsive & can work just about anywhere.

Thanks!

3 Likes

What’s so difficult about the fence to the wall?

I don’t think I entirely understand what you’re asking, but I’m not saying any of these things are particularly difficult. I’m asking for preliminary design suggestions on how to make a system like such efficient and fluent.

If you have any suggestions on networking or physics-based solutions that could solve these questions, it’d be nice to hear them.

for the fence try using this - YouTube

1 Like

Hello, Sorry If This Ain’t Relevant Anymore But I Did Vaulting Script A Second Ago Which Does Not Limit You To The Part Name So If You Want I Can Send It Here.

would be cool if you sent it :)))))))))

i mean why not its not that hard to code it
time to cut half of code cuz i also added clambering to it


local UIS = game:GetService("UserInputService")


local player = game.Players.LocalPlayer
local character = player.Character
local HumanoidRootPart = character:WaitForChild("HumanoidRootPart")

local raycastParams = RaycastParams.new()
raycastParams.FilterType = Enum.RaycastFilterType.Blacklist; raycastParams.FilterDescendantsInstances = {character}; raycastParams.IgnoreWater = true

game:GetService("RunService").Heartbeat:Connect(function()
	local rayF = workspace:Raycast(character.HumanoidRootPart.CFrame.Position, character.HumanoidRootPart.CFrame.LookVector * 2 + character.HumanoidRootPart.CFrame.UpVector * -1.25, raycastParams)
	local rayU = workspace:Raycast(character.HumanoidRootPart.CFrame.Position, character.HumanoidRootPart.CFrame.LookVector * 3 + character.HumanoidRootPart.CFrame.UpVector , raycastParams)


	local ray = rayF


	if ray ~= nil and rayU == nil and character.Humanoid.FloorMaterial ~= Enum.Material.Air then
		local Vel = Instance.new("BodyVelocity")
		Vel.Parent = HumanoidRootPart
		Vel.Velocity = Vector3.new(0,0,0)
		Vel.MaxForce = Vector3.new(1,1,1) * math.huge
		Vel.Velocity = HumanoidRootPart.CFrame.LookVector * 15 + Vector3.new(0,25,0) 
		wait(0.15)
		Vel:Destroy()
	end
end)
6 Likes