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

How do you convert a cframe into a rotation?

Asked by
uhSaxlra 181
4 years ago

I'm trying to have a turret rotate towards a target using it position, but I'm not sure how to convert that into a radian angle for the motor.

    local radX, radY, radZ = cf:ToOrientation() 
    script.Parent.Turret.Main.Motor.DesiredAngle = radY

The script currently over turns, any help is appreciated.

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

Hello. Fortunately, it is very easy. Just use math.rad(number degree). It converts a degree into a radiant. Please upvote and accept this answer if it helped.

0
Thanks for the help but I need it to get a radian value and turn towards an object in space uhSaxlra 181 — 4y
0
Just use "CFrame.new(obj1.Position, obj2.Position)". youtubemasterWOW 2741 — 4y
Ad

Answer this question