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

What's the Easiest Way to Change a Model's Orientation?

Asked by 5 years ago

I know you would have to use some functions on the model's primary part, but what is the most efficient way to do this?

1 answer

Log in to vote
1
Answered by
DanzLua 2879 Moderation Voter Community Moderator
5 years ago

Lets use the :SetPrimaryPartCFrame() function to move/orientate the models

First make sure your model has a PrimaryPart set

Before you set the model's parent, use the function to set its position

We will change its orientation using CFrame.Angles() CFrame.Angles uses something called radians which you will learn in trigonometry. You may be more known with the term degrees instead, roblox gives us a way to easily change degrees to radians without us having to math using math.rad(degrees)

local model=model
--position and orientation
local cf=CFrame.new(0,0,0)*CFrame.Angles(0,math.rad(90),0)

--setprimarypartcframe take a cframe value which is applied to the model's primarypart
--the other parts are moved along with the primarypart
model:SetPrimaryPartCFrame(cf)
0
I appreciate the support, but I'm a CS student in college. I have taken Trig and Calculus 2 already. I've known what radians are since eighth grade... corncob567 275 — 5y
0
@corncob567 Sorry for assuming, most my answers are written for more beginner typed people. That paragraph was pulled from a early post from today that I wrote for someone knowing nothing. DanzLua 2879 — 5y
Ad

Answer this question