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

BodyGyro Facing the Same Place?

Asked by 6 years ago

I'm trying to make a part with BodyGyro face another part, but whenever I try to edit the code of where it's facing (CFrame I'm Assuming), it just keeps facing the same way.

From the Wiki:

local b = Instance.new('BodyGyro')
b.maxTorque = Vector3.new(math.huge, math.huge, math.huge)
b.cframe = CFrame.new(0, 10, 0)
b.Parent = Workspace.Part

Anyone know what I'm doing wrong?

0
`b.CFrame = DiffPart.CFrame` :o TheeDeathCaster 2368 — 6y
0
No it's just he using a lower case cf it's b.CFrame = CFrame.new(0,10,0) GetGlobals 343 — 6y
0
I tried that, It still doesn't work WaddelsG 69 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

You have to use CFrame.Angles for a rotational CFrame, so

local b = Instance.new('BodyGyro')
b.Parent = Workspace.Part
b.maxTorque = Vector3.new(math.huge, math.huge, math.huge)
b.CFrame = CFrame.new(0, 0, 0) * CFrame.Angles(0, math.rad(math.pi()), 0)

That will turn it 180 degrees around on it's y axis, as if you stuck a hinge right through the part from top to bottom. Best way I could explain it.

Ad

Answer this question