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

What does fromEulerAngles do?

Asked by 8 years ago

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

2 answers

Log in to vote
2
Answered by 8 years ago

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
0
Another option is `rotation + Vector3.new(0, 25, 6)` to get orientation and position BlueTaslem 18071 — 8y
0
That could work, too. nighttimeninja314 120 — 8y
Ad
Log in to vote
0
Answered by
Pyrondon 2089 Game Jam Winner Moderation Voter Community Moderator
8 years ago

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)

Answer this question