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

How to set the default orientation of Body Gyro?

My BodyGyro points my mesh part in the wrong orientation. How can I fix this?

For example if my part was a rocket that points at a player, it would be flying sideways at the player.

1 answer

You would want to use CFrame which which changes the orientation of the object to face another.

Example:

local part1 = game.Workspace.Part1 -- The part that will turn to face Part2
local part2 = game.Workspace.Part2
part1.BodyGyro.cframe = CFrame.new(part1.Position, part2.Position)

To get it to face a certain target you would need to use mouse.Hit.p which will give the position of the part the mouse was on when it was triggered.

Example:

local player = game:GetService('Players').LocalPlayer
mouse = player:GetMouse()

brick.CFrame = Part.CFrame -- change part with where the ball with start at
brick.CFrame = Cframe.new(brick.Position,mouse.Hit.p)

Hope this helps!

Also look at BodyGyro CFrame

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