How do I make a part that acts like there is air around it?
I have been looking for a way to make a plane wing for my building game, but nothing I have found or tried so far has worked
I found multiple air-resistance scripts to use and they appeared to work but don’t work when I insert them into my part. I am trying to make a game similar to @madattak’s plane crazy, and I found out how he made his plane wings, but when I tried the same thing, it didn’t work. The method they used was a script made by @AtAltitude which adds in air resistance, and I tried to insert the air resistance script into the part, but it just falls out of the sky. I’m assuming this is because the part is too small but I don’t know how Madattak dealt with this or if they did not have this issue.
how should I go about creating something for the air resistance for my part?
here is the code from AtAltitude’s script
--Aerodynamic Brick by VolcanoINC
--Presets
Factor = -0.1
--Global Definitions
p = script.Parent
f = p.Force
vector = Vector3.new
--Area calculations
front = p.Size.x * p.Size.y
side = p.Size.z * p.Size.y
top = p.Size.x * p.Size.z
--Functions
function relpos(x, y)
local HitPos = x
local CJ = CFrame.new(HitPos)
local C0 = CFrame.new(-x) * CJ
local C1 = y.CFrame:inverse() * CJ
local ReturnCF = C0 * (C1:inverse())
return ReturnCF:inverse().p
end
function pn(x)
if (x > 0) then return 1 end
if (x < 0) then return -1 end
return 0
end
--Main
while true do
wait()
local fr
local tr
local sr
local vp
if (workspace:findFirstChild("Wind")) then
fr = ((p.Velocity + workspace.Wind.Value) * p.CFrame.lookVector).magnitude * front
tr = ((p.Velocity + workspace.Wind.Value) * (p.CFrame * CFrame.Angles(math.rad(90),0,0)).lookVector).magnitude * top
sr = ((p.Velocity + workspace.Wind.Value) * (p.CFrame * CFrame.Angles(0,math.rad(90),0)).lookVector).magnitude * side
vp = relpos(p.Position + p.Velocity + workspace.Wind.Value,p)
else
fr = (p.Velocity * p.CFrame.lookVector).magnitude * front
tr = (p.Velocity * (p.CFrame * CFrame.Angles(math.rad(90),0,0)).lookVector).magnitude * top
sr = (p.Velocity * (p.CFrame * CFrame.Angles(0,math.rad(90),0)).lookVector).magnitude * side
vp = relpos(p.Position + p.Velocity,p)
end
local vpx = pn(vp.x)
local vpy = pn(vp.y)
local vpz = pn(vp.z)
f.force = vector(sr * vpx,tr * vpy,fr * vpz) * Factor * p:GetMass()
end
and here is what happens to my part
robloxapp-20221218-1520418.wmv (4.6 MB)