How do I Start to Script a drivable Helicopter?

How do I change the orientation in the cframe only? on Alignorientation

1 Like

You have to use CFrame.Angles, sorry for the misinformation earlier.

Code:

AlignOrientation.CFrame = CFrame.Angles(math.rad(20), 0, 0)
1 Like

It keeps going to 0,90,0 even though this is script:

	if VehicleSeat.Steer == -1 then
		AlignOrientation.CFrame = CFrame.Angles(0,math.rad(45),0)
		MainLinearVelocity.VectorVelocity = Vector3.new(MainLinearVelocity.VectorVelocity.X,MainLinearVelocity.VectorVelocity.Y,-MaxLinearVelocity)
	elseif VehicleSeat.Steer == 1 then
		AlignOrientation.CFrame = CFrame.Angles(0,math.rad(-45),0)
		MainLinearVelocity.VectorVelocity = Vector3.new(MainLinearVelocity.VectorVelocity.X,MainLinearVelocity.VectorVelocity.Y,MaxLinearVelocity)
	elseif VehicleSeat.Steer == 0 then
		AlignOrientation.CFrame = CFrame.Angles(0,math.rad(0),0)
		MainLinearVelocity.VectorVelocity = Vector3.new(MainLinearVelocity.VectorVelocity.X,MainLinearVelocity.VectorVelocity.Y,0)
	end
1 Like

What did you set the Responsiveness and MaxForce too? Could you also send a video?

1 Like

When it rotates is when I change rotation with studio, then when it goes back thatā€™s when I steer


image

1 Like

Where to start is easier than ever in Roblox. There are many premade designs of whatever youā€™re looking for in most cases. Even though Iā€™m a big fan of doing it all my way. Sneak peeking at previous designs is a gift that is hard to pass up. Always seem to find something close to what I want to do and with some re-editing can get it to work out. Also, Iā€™ve seen some pretty sweet helicopters in the toolbox models.

2 Likes

I need to go to sleep now, but just keep testing different values on the AlignOrientation, your responsiveness may be too low. Make sure to watch the tutorials I sent.

2 Likes

Iā€™m making this helicopter not with free models and I canā€™t understand other peoples code or too lazy to read it

2 Likes

I got it to turn when steer changes now I just have to implement constant rotation

1 Like

IT WORKS it can now turn the whole body and steer correctly without align orientation idk if I would have ever got this done

I used a loop

while task.wait() do
	if VehicleSeat.Steer ~= 0 then
		AlignOrientation.CFrame *= CFrame.Angles(AlignOrientation.CFrame.Rotation.X,-script.Parent.Steer/50,AlignOrientation.CFrame.Rotation.Z)
	end
end

it may be inefficient but at least it works

1 Like

I would recommend using ā€œtask.waitā€ instead of ā€œwaitā€ due to wait being older and laggier.

2 Likes

Good work, Iā€™m actually impressed you learnt all of this so quickly. To improve your loop, you should just use task.wait() without any numbers so it updates every frame, it will be way smoother without a noticeable performance difference.

If you would like to, I would love to see a video of the helicopter.

2 Likes

Here is video of helicopter:

It may not be realistic, but it works
I tried to use task.wait() but it was going too fast so it would rotate the whole thing causing the helicopter to not steer so I just used .1

1 Like

Just make it divided by 100 instead of 10 then. It would be more responsive.

Code:

while task.wait() do -- changed to tas k wait
	if VehicleSeat.Steer ~= 0 then
		AlignOrientation.CFrame *= CFrame.Angles(0, script.Parent.Steer/100, 0)
	end
end

Also, to make it look more realistic, you can make the helicopter tilt forward and backward when moving by setting the AlignOrientationā€™s CFrame.

1 Like

I did try to make the helicopter tilt, but since the CFrame is not dependent on its own axis, itā€™s hard to implement that kind of system and it was buggy, I also updated it with the more responsive code

1 Like

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