Rotate Blades without physics

i have this helicopter controller and im currently trying to implement animatable rotor blades. the problem i that when i use HIngeContraints, the helicopter reacts to it by spinning the other direction and all that.

Wanted Behavior:

Result:

is there a way to rotate the blades smoothly without it affecting the helicopter, while keeping accurate collision for when the blades get damaged.

5 Likes

Have you tried setting the Massless property of the blades to true? I think that would work. :happy1:

3 Likes

Setting it massless doesn’t actually make it massless, it only becomes massless when its welded another part that has mass. This doesn’t apply to parts connected with a constraint

1 Like

Oh okay, I didn’t know that.
You could try enabling custom physical properties and setting density to 0 (or as low as it will go). If it doesn’t go to zero, it wouldn’t be a perfect solution, but it would be a temporary solution.

1 Like

And @ThatBushyZaza.
What if you set both the rotor Part and the mast Part to Massless?
Constraints have strange behaviour when the 2 items they join have different Densities.
Or make the Rotor Density .001.
Or use a HingeConstraint but set it to None instead of Motor, then use RotationalVelocity on the blades to spin them.

1 Like

I don’t know of a constraint which can do this without Reaction forces (opposing forces), so my method would be to either use a AlignOrientation and lock the main body to a certain axis, or to script the animation for the blades. Something like this

local RS = game:GetService(“RunService”)

local propeller = workspace.copter.blade

RS.Heartbeat:Connect(function(dt)
    propeller.CFrame = propeller.Parent.Base.CFrame:ToWorldSpace(
CFrame.new(0,5,0) * —Offsets the blade above the base
CFrame.Angles(0,math.rad(propeller.Orientation.Y+60*dt),0) —Increments the rotation of the propeller 
)
end)

If you don’t like that, Use a rigid constraint to connect the propeller and the base, and increment the rotation of one of the attachments.


local RS = game:GetService(“RunService”)

local propeller = workspace.copter.blade

RS.Heartbeat:Connect(function(dt)
    propeller.BaseAttachment.Orientation += Vector3.new(0,60*dt,0)
end)

If you don’t want to use physics, you just need to make it anchored and then just set the cframe manually to propellers with offset of size, etc.

I will assume you will have local called propellersJoint

local RunService = game:GetService("RunService")

local propellerAngleCounter = 0

function updatePropellers(deltaTime)
   propellerAngleCounter += desiredSpeed * (deltaTime / (1/60))

   local propellersJointSize = propellersJoint.Size
   local jointOffset = propellersJoint.CFrame * CFrame.new(0, propellersJointSize.Y / 2, 0)
   local propellerSideOffset = CFrame.new(propeller.Size.X / 2, 0, 0)

   blade.CFrame = jointOffset * propellerSideOffset * CFrame.Angles(0, propellerAngleCounter, 0)
end

RunService["Heartbeat"]:Connect(updatePropellers)

Set the desiredSpeed as the speed of how quickly you want the propeller.

the both massless option doesnt work, the none actuator still produces reaction forces, the closest to what i want was the rotor density, but even that it does go completly away

1 Like

collisions dont work on this one

1 Like

do i still weld the parts or use contraints?

2 Likes

Check the edited bit, that is generally how it should be done, may have some errors wrote this on here.

1 Like

Probably not the answer but would adding a tail rotor correct this turning? Or could you maybe add the rotation in the opposite direction at a way smaller speed to the main helicopter?

1 Like

it seems the only option i found was to use manualwelds and editing the c1 property to make it spin, the only issue now is that it doesnt look smooth, especially at high speeds

edit: it actually it smooth if the code running it is on the client and not on the server, so that will work for now

local motor = script.Parent.Weld

game["Run Service"].Stepped:Connect(function(t, dt)
	motor.C1 *= CFrame.Angles(0, dt * speed, 0)
end)
1 Like

Just throwing out some other ideas, I know you solved it.

Strange that a Hinge Motor set to None produces an opposite reaction.
If it is the same rotation would it possibly be the Friction between the blades and the mast? Would be easy enough to check by raising the Mast Attachement so they didn’t touch.
Or possibly switch the Attachment0 and Attachment1 of the HingeConstraint to see if only one of them causes the force.

1 Like

Now that i remember, there was no counter force, but there was still a very noticable wobble, maybe the wobble was because of the actual blade shape?

This is just a suggestion but maybe using motor6d could be the solution u are looking for.

Making doors using constrains is a pain because it would always interact with the walls, when u use a motor6d it completely ignores and goes through them, and u can make it spin forever by just changing the MaxVelocity(something between 0.1 and 0.01) and DesiredAngle(math.huge).

U could also make it a rig and create animations for it too.

Tried that, but for some reason the blades only spin if the player is nearby, farther out and they stop

Constraints sometimes freeze up when networkownership passes back and forth to the server.

As far as the wobble, do you have AerodynamicForces true on the blades? If so try making it false. Are you sure the center Attachment is actually at center. If not it would cause the blades to be out of balance.

1 Like

Ok so i figured it out, basically i created a part with the size of 1 by .25 by 1 studs and made its density 0.01, which due to its small size makes the mass effectively zero. i then attach it to the helicopter with a HingeContraint and set it to motor. now i can just weld any visual parts to it and make those parts massless. No counterforce, no wobble, and the helicopter behaves just fine.

huge thanks to everyone who replied since it ended up giving me the idea.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.