What is the best way to go about making an airwalk system?
The current system I have uses a BodyPosition with a max force of 0 for the x and z values so the player can move with WASD, but this leads to the player looking like they are just floating and suspended in free fall.
I want to give the impression that the player is actually moving through the air with their legs. What alternatives would allow me to do this, but keep the same functionality?
I am looking for an effect similar to the anime Bleach:
airwalking = true
local air1 = RS.Assets.AirWalkParticle:Clone()
air1.Parent = character["Left Leg"].LeftFootAttachment
air1.Name = "AirwalkParticle"
local air2 = RS.Assets.AirWalkParticle:Clone()
air2.Parent = character["Right Leg"].RightFootAttachment
air2.Name = "AirwalkParticle"
local bodyPosition = Instance.new("BodyPosition")
bodyPosition.MaxForce = Vector3.new(0,100000,0)
bodyPosition.Position = character.HumanoidRootPart.Position + Vector3.new(0,10,0)
bodyPosition.P = 10000
bodyPosition.Name = "AirwalkPosition"
bodyPosition.Parent = character.HumanoidRootPart
You might be able to spawn a small invisible platform under the player’s feet which updates it’s CFrame to constantly follow the player in all directions.
As a rough pseudo-code guide, you could use these functions:
-- some variables you want set up
local airwalking = false
local airwalkPlatform = nil
-- call this when the player starts their airwalk
airwalking = true
airwalkPlatform = Instance.new("Part")
airwalkPlatform.Anchored = true
airwalkPlatform.Transparency = true
airwalkPlatform.Size = Vector3.new(4,1,4)
-- call this when the player completes the airwalk
airwalking = false
-- you will need some way to update the part's position on each Physics Step
if airwalking and airwalkPlatform ~= nil then
--The -3.5 is determined by the distance from the ground to the position of the HumanoidRootPart, plus half of the height of the part itself as defined in airwalkStart()
airwalkPlatform.CFrame = CFrame.new(character.HumanoidRootPart.Position + Vector3.new(0,-3.5,0))
If you had any issues with the invisible part colliding with unwanted things, such as unanchored objects or other players, you can set up Collision Groups to mitigate that issue. It should also be fairly easy to add your desired effects and graphics as needed.
I’m not too familiar with this, but couldn’t you keep the player from Humanoid.FreeFalling and reset the HumanoidStateType to Humanoid.Running?
You can just set the HipHeight of the humanoid to something I think
character.Humanoid.HipHeight = 100
-- 100 studs up
character.Humanoid.HipHeight = 0
I’m not very familiar with CollisionGroups, but I’ll look into it. Thanks!
Another question, is that method better than just welding the platform to the player’s HumanoidRootPart?
This makes the character infinitely do the running animation although they are standing still.
Then you change it to .idle when the player stops moving.
Give @BirdieI90’s answer a try first. It’s probably the easiest thing to do.
Although instead of resetting it to 0 after you should get their original hipheight and store that then reset it to that value.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.