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

Is their anyway to stop the part from following player rotation?

Asked by
PastDays 108
6 years ago
local i = 0
local Distance = 5
local Speed = 0.07
local Angle = 0
local Part = script.Parent
local Orbiting = script.Parent.Parent.HumanoidRootPart

    while true do
        i=i+1
        wait()
        Part.CFrame = Orbiting.CFrame*CFrame.fromEulerAnglesXYZ(Angle,i*Speed,0)*CFrame.new(0,-2,Distance)
    end

The 'Part' slowly orbits the player but if the player rotates the part follows the player roatation, is there anyway to prevent this?

2 answers

Log in to vote
0
Answered by
DevSean 270 Moderation Voter
6 years ago
Edited 6 years ago

By using Orbiting.CFrame you're getting the player's rotation, you can instead create a new CFrame with no rotation through the following:

CFrame.new(Orbiting.Position)
Ad
Log in to vote
2
Answered by 6 years ago

I can't see the whole line, but consider using the position of the character rather than the CFrame as that contains the rotation.

CFrame.fromEulerAnglesXYZ()*CFrame.new() + Orbiting.Position

Answer this question