So far i got everything to work well, but one part is confusing me heavily.
local wp = game:GetService("Workspace")
local heading = wp.GameObjects.Indicators:WaitForChild("Heading")
local pitch = wp.GameObjects.Indicators:WaitForChild("Pitch")
local ship = wp.GameObjects:WaitForChild("Ship")
local RunService = game:GetService("RunService")
local lerpFactor = 0.1
local fixedHeadingY = math.rad(180)
local fixedHeadingZ = math.rad(90)
local function Point()
local PitchX = script:GetAttribute("PitchX")
local PitchZ = script:GetAttribute("PitchZ")
local targetCFrame = ship.CFrame.Rotation
local targetHeadingCFrame = CFrame.Angles(0, fixedHeadingY, fixedHeadingZ)
local newHeadingCFrame = heading.CFrame:Lerp(targetCFrame * targetHeadingCFrame, lerpFactor)
heading.CFrame = CFrame.new(heading.Position) * newHeadingCFrame.Rotation
local targetPitchCFrame = CFrame.Angles(math.rad(PitchX), 0, math.rad(PitchZ))
local newPitchCFrame = pitch.CFrame:Lerp(targetCFrame * targetPitchCFrame, lerpFactor)
pitch.CFrame = CFrame.new(pitch.Position) * newPitchCFrame.Rotation
end
RunService.Heartbeat:Connect(Point)
This is what is happening:
This is what i want it to do:
Note that the bigger arrow is PROGRADE, the smaller arrow is RETROGRADE. This works based on the ship’s orientation however, i’m not trying to make it point to where your ship is going.
For context:
- Orange circle (Heading): Only rotates on a single axis, sorta lining up with the blue circle indicating where the ship is heading
- Blue circle (Pitch): I guess this is self explanatory? Indicates where the ship is facing.
Those two end up making a sort of 2d sphere of sorts if you know what i mean.
Here’s a image of what it looks like in Juno: New Origins:
I don’t want to include the cones indicating the velocity, just the direction indicator’s good enough for this. Does someone know what i’m doing wrong?
Any help would be appreciated. (please help this is for a school project)