Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do you convert a cframe into a rotation?

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

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.

2 comments

0

Thanks for the help but I need it to get a radian value and turn towards an object in space

0

Just use "CFrame.new(obj1.Position, obj2.Position)".

This discussion is preserved as it was. New answers, comments, and votes are closed.