Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make a brick smoothly rotate while Body Velocity is present?

Asked by
Nidoxs 190
8 years ago

So I have a couple of parts that are welded and It is supposed to be a rocket. When You click the engine it start to fly. However I want the rocket to smoothly turn and crash into the ground. I tried this and it does this weird snappy rotation where its like -90 90 - 180 and not .6 .12 .18 and so on. Here is the script :

flying = false
function fire()
script.Parent.BodyVelocity.velocity = Vector3.new(0,1,0)
flying = true
wait(3)
for i = 1, 10 do
script.Parent.BodyVelocity.velocity = script.Parent.BodyVelocity.velocity + Vector3.new(0,.2,0)
wait()
end
wait(2)
while flying == true do
script.Parent.BodyVelocity.velocity = script.Parent.CFrame.lookVector * 25
script.Parent.CFrame = script.Parent.CFrame * CFrame.fromEulerAnglesXYZ((math.rad(-.6)),0,0)
wait(.1)
end
end

script.Parent.ClickDetector.MouseClick:connect(fire)
0
It works perfectly, I don't see your problem laughablehaha 494 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

I'd recommend you use a BodyGyro. Change the BodyGyro.cframe, similar to the part's CFrame and change the "D" (Dampning) property of the BodyGyro to reduce the snappiness.

A great thing about Gyros are that you can set the cframe to what would point the part straight down, and give it a high D property, and it will slowly curve down to the ground (although this if not recommended if you want it to tilt a certain way).

Ad

Answer this question