-
How do I check if player is on air and have a certain distance from the ground?
-
Is hard to check when using raycast in server since it sometime don’t match with the client.
-
The solution I have so far is raycasting with client script
You stated that you already have a solution since you’ve posted this does that mean there’s a preferable method you’re looking for?
the client still somehow buggy with raycast so I’m still looking for better way
raycasting is usually the way to go but theres also humanoid.floormaterial and when they are off the ground it will return .Air
In what sense is the client buggy?
like sometime I using vector force or any velocity on player it some how still think player is on ground
can you send over the script(s) used?
module.OnGround = function(Character)
local Value = "OnAir"
local rayParams = RaycastParams.new()
rayParams.FilterType = Enum.RaycastFilterType.Exclude
rayParams.FilterDescendantsInstances = {Character,workspace.Terrain,workspace.Entities}
local ray = workspace:Raycast(Character.PrimaryPart.Position,Character.PrimaryPart.CFrame.UpVector * -10,rayParams)
if ray and ray.Distance <= 10 then
Value = "OnGround"
end
return Value
end
and
Running.AirTrick = function(Character)
Character.Humanoid.AutoRotate = false
delay(1,function()
Character.Humanoid.AutoRotate = true
end)
local Attachment = Instance.new("Attachment",Character.PrimaryPart)
Debris:AddItem(Attachment,.75)
local AlignPosition = Instance.new("AlignPosition",Attachment)
AlignPosition.MaxForce = 100000
AlignPosition.Mode = Enum.PositionAlignmentMode.OneAttachment
AlignPosition.ApplyAtCenterOfMass = true
AlignPosition.Responsiveness = 1000
AlignPosition.Position = (Character.PrimaryPart.CFrame * CFrame.new(0,25,0)).Position
AlignPosition.Attachment0 = Attachment
local AlignOrientation = Instance.new("AlignOrientation",Attachment)
AlignOrientation.CFrame = Character.PrimaryPart.CFrame
AlignOrientation.Mode = Enum.OrientationAlignmentMode.OneAttachment
AlignOrientation.Attachment0 = Attachment
AlignOrientation.RigidityEnabled = true
AlignOrientation.PrimaryAxisOnly = true
end
what are you trying to accomplish and why do you need to know the distance to the ground
I’m trying to make the air combat and it need to have certain distance from the ground
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.