You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I’m trying to make the compass, the red tick to always face north relative to the compass orientation. -
What is the issue? Include screenshots / videos if possible!
I’ve been trying to make it face north but it won’t work, Im confused since when the compass rotates, it switches rotations and if I make the red tick face north, it wont be flat on the compass. -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried to take in account only the yaw for the red pointer but when the compass rotates, yaw doesnt work anymore, its either roll or pitch or a combination of both.
local last_YRotation = 0
local SP_N = Spring:create()
function TicksDirection(dt)
local Compass = script.Parent:FindFirstChild("Item")
local Red_Pointer = Compass:FindFirstChild("Red")
local White_Pointer = Compass:FindFirstChild("White")
local GoldHold_Orientation = Compass:FindFirstChild("GoldHold").Orientation
local RX,new_YRotation,RZ = Compass.Border:GetPivot():ToOrientation()
new_YRotation= math.deg(new_YRotation)
local diff = (new_YRotation-last_YRotation)*1.2
SP_N:shove(Vector3.new(0,diff,0))
local update = SP_N:update(dt)
Red_Pointer:PivotTo(CFrame.new(Compass.GoldHold:GetPivot().Position) * CFrame.fromOrientation(math.rad(GoldHold_Orientation.X),math.rad(GoldHold_Orientation.Y),math.rad(GoldHold_Orientation.Z)) * CFrame.Angles(0,math.rad(update.Y/5),0))
--White_Pointer:PivotTo(CFrame.new(Compass:FindFirstChild("GoldHold"):GetPivot().Position) * CFrame.Angles(0,math.rad(360),0))
last_YRotation = new_YRotation
The GoldHold Instance is the gold cylinder in the middle, as it holds the pointers.
I’m in a dead end now, angles are very confusing