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

What does fromEulerAngles do?

I have looked this up and have found nothing. please explain what this is.

2 answers

✓ Accepted answer

This is the equivalent of > CFrame.Angles.

Euler angles are all about orientation. The three input values it takes are

RX RY and RZ

The "R" stands for radians. A radian is essentially just an angle but in a different format in which one radian is the distance a circle's radius covers around the circumference of a circle.

This Short Gif really helps to explain how they work.

You don't have to have a complete understanding of radians to make a rotated part in roblox. If you prefer using just degrees, you can lua's method of turning a degree angle into a radian.

> math.rad(90); -- would be the value of one-half pi radians.

here is an example of how you would construct a simple CFrame.

local rotation = CFrame.fromEulerAngles(math.rad(25), math.rad(106), math.rad(73));
workspace.Part.CFrame = rotation

Please note that this only defines orientation. In order to add a position to a rotation you would do it like this.

local position = CFrame.new(0,25,6) -- should be a CFrame value, not Vector3
local rotation= CFrame.fromEulerAngles(math.rad(25), math.rad(106), math.rad(73));
workspace.Part.CFrame = position * rotation

2 comments

0

Another option is rotation + Vector3.new(0, 25, 6) to get orientation and position

0

That could work, too.

Euler Angles can be used to rotate a brick from a script using CFrame.

E.g:

brick.CFrame = CFrame.Angles(math.pi, math.pi/2, math.pi)

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