I am trying to make a helicopter, It’s almost done, I need a few effects, how to make the rotator spin?
I am using weld constraint to weld it.
It seems when I change Torque it doesn’t spins
What should I use?
I am trying to make a helicopter, It’s almost done, I need a few effects, how to make the rotator spin?
Use welds instead of weld constraints and change the offset:
Here is the demo place:rotorDemo.rbxl (24.7 KB)
-----------------------------------------------------------------------
--CHANGE THESE TO THE LOCATIONS OF YOUR WELDS
local base = workspace.Base -- THE PART YOUR'RE WELDING THE ROTOR TO
local rotor = workspace.Rotor -- THE ROTOR
local weld
local rotationSpeed = 5 --change this to change how fast the rotor goes
local isRotorEnabled = false
-----------------------------------------------------------------------
local function createWeld(part0, part1, weldType, offset)
local weld = Instance.new(weldType or "Weld")
offset = offset or CFrame.new()
weld.Part0 = part0
weld.Part1 = part1
weld.C0 = part0.CFrame:inverse() * part1.CFrame * offset
weld.Parent = part0
return weld
end
--rotates the rotor
function toggleRotor()
isRotorEnabled = not isRotorEnabled
coroutine.wrap(function()
while isRotorEnabled do
wait()
local offset = CFrame.Angles(0,math.rad(rotationSpeed),0)
weld.C0 = weld.Part0.CFrame:inverse() * weld.Part1.CFrame * offset
end
end)()
end
weld = createWeld(base, rotor)
toggleRotor() -- toggle rotor on
wait(5)
toggleRotor() --toggle rotor off
As rotor speed increases, which it has to because helicopter wings spin fast, the movement will get choppier and choppier, and your script is frame-rate dependent as well.
rotorDemo.rbxl (24.8 KB)
Here is the same example from @royaltoe but much smoother. It uses Hinge Constraint.
And no scripting required at all!