I’m currently creating a fully custom car, and I am hoping to tell whether the car is in the air or not as I don’t want it to glitch a bit in the air. I currently have
local touchingparts = {
[script.Parent.WheelFL] = script.Parent.WheelFL:GetTouchingParts(),
[script.Parent.WheelFR] = script.Parent.WheelFR:GetTouchingParts(),
[script.Parent.WheelBL] = script.Parent.WheelBL:GetTouchingParts(),
[script.Parent.WheelBR] = script.Parent.WheelBR:GetTouchingParts()
}
local inair = true
for wheel, parts in pairs(touchingparts) do
for i, part in pairs(parts) do
if part.CFrame.Position.Y < wheel.CFrame.Position.Y and not part.Parent:FindFirstChild("Humanoid") then
local touchingother = false
for wheel2, parts2 in pairs(touchingparts) do
if wheel2 ~= wheel and table.find(parts2, part) then
touchingother = true
end
end
if touchingparts then
inair = false
end
end
end
end
This doesn’t cause any errors but also doesn’t always detect properly. Is there a better way to go about this and tell whether it is on the ground properly? Here is a video of the problem:
And yes, I have tried using raycasting from the body downward, which was also causing problems on ramps.