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

Is there any way to rotate a model on it's PrimaryPart?

Asked by 4 years ago

I have a door here and I want it to smoothly rotate to a certain rotation. I know that I need to use CFrame and Lerp() to achieve what I want.

The problem is I am not sure what to actually do to achieve a "opening door" style rotation. If I rotate the casual way, the door will look "weird", if I rotate the door on the door's "rotating part" it will look like an actual door.

I have something like this going on:

local Door = script.Parent
local RotatingPart = Door.RotatingPart
local Angle = CFrame.Angles(0, math.rad(45), 0)

RotatingPart.CFrame:Lerp(Angle, 1, 0.1)

I went on the cframe page for roblox and it showed something like :ToWorldSpace(), I'm not sure if I understand the whole thing but judging by the picture I could have a part that has the rotation and set the "hinge part" to that rotation relativity.

Do I use something like :SetPrimaryPartCFrame and use CFrame.Angles() to rotate the door or is there any flip-flop way to set it like a door "rotation"?

Thank you for viewing

0
yeah, just edit the PrimaryPart's CFrame DeceptiveCaster 3761 — 4y
0
SetPrimaryPartCFrame(Position, Looking position) just do that TheRealPotatoChips 793 — 4y

Answer this question