A little background, I'm trying to make a 3-Dimentional radar; I'm using a local part, a sphere which I negated the center and sections of so it's kind of wireframe. When the player tilts forward, I want the sphere, no matter what orientation it's in, to tilt forward from the player; if that makes sense. This is what I currently have:
Also, I have FilteringEnabled, so this is a local part; no one else can see it.
local plr = game.Players.LocalPlayer local ship = plr.Character:WaitForChild("Plane") local engine = ship.Parts.Engine local radar = script.Parent.Radar if ship.Parts:FindFirstChild("RadarPoint") == nil or game.Workspace.FilteringEnabled == false then script:remove() end radar.Parent = game.Workspace radar.Anchored = true local lastx, lasty, lastz = 0,0,0 local deltaxtotal, deltaytotal, deltaztotal = 0,0,0 function updateRadar() local x,y,z = engine.CFrame:toEulerAnglesXYZ() local deltax, deltay, deltaz = x-lastx, y-lasty, z-lastz deltaxtotal, deltaytotal, deltaztotal = deltaxtotal+deltax, deltaytotal+deltay, deltaztotal+deltaz local position = ship.Parts.RadarPoint.CFrame radar.CFrame = position * CFrame.Angles(deltaxtotal, deltaytotal, deltaztotal) lastx, lasty, lastz = x,y,z end game:GetService("RunService").RenderStepped:connect(updateRadar)
It doesn't do what I want; it actually acts as a gyro, identifiying the orientation compared to 0,0,0.
I can think of two ways to achieve my goal.
Figure out the trig required to alter all of the CFrame angles so that it does what I want(I can deal with this if I have to, I would just prefer to not if possible)
Reset the CFrame angles of the object to be 0,0,0 each time through but keep the orientation of the object. Is that possible? Edit: To be more clear, I want to be able to rotate the block based a specific coords and rotation, not based on the world coords and rotation. I.e. Rotate it so that, if I rotate on an axis, it always rotates the same direction relative to a different block.
Please, try this. You need to reset the CFrame every time..
local plr = game.Players.LocalPlayer local ship = plr.Character:WaitForChild("Plane") local engine = ship.Parts.Engine local radar = script.Parent.Radar if ship.Parts:FindFirstChild("RadarPoint") == nil or game.Workspace.FilteringEnabled == false then script:remove() end radar.Parent = game.Workspace radar.Anchored = true local lastx, lasty, lastz = 0,0,0 local deltaxtotal, deltaytotal, deltaztotal = 0,0,0 function updateRadar() local x,y,z = engine.CFrame:toEulerAnglesXYZ() local deltax, deltay, deltaz = x-lastx, y-lasty, z-lastz deltaxtotal, deltaytotal, deltaztotal = deltaxtotal+deltax, deltaytotal+deltay, deltaztotal+deltaz local position = ship.Parts.RadarPoint.Position radar.CFrame = CFrame.new(position)* CFrame.Angles(deltaxtotal, deltaytotal, deltaztotal) lastx, lasty, lastz = x,y,z end game:GetService("RunService").RenderStepped:connect(updateRadar)