What do you want to achieve?
I’m trying to make a camera that hovers above the player’s left side, and aims where the camera is looking. There’s only one issue: It appears to roll when it should be pitching.
What is the issue?
The issue, as described above, is that the camera ball rolls instead of pitches. See attached video.
What solutions have you tried so far?
I’ve tried adjusting a ton of different parameters to get to this point; but I can’t seem to figure out how to swap 2 rotations…
Code that I have so far:
Backpack.Flashlight.AttemptSync.OnServerEvent:Connect(function(player: Player,lookVec:Vector3)
if player.Character ~= C then return end -- though this shouldn't happen
assert(typeof(lookVec) == "Vector3","Input must be a V3.")
local CF = CFrame.new(Vector3.zero,lookVec)*CFrame.Angles(0,math.rad(90),0)
local characterCF = C:GetPivot()-C:GetPivot().Position
Backpack.O2Tank.Pivot.RotatePivot.CFrame = characterCF:ToObjectSpace(CF) + Vector3.new(0.911, 1.7, -2.026)
end)
Any help with this would be welcomed. This is kinda driving me nuts. [and yes the flashlight is not supposed to be looking at the camera but I inverted the 90 for the purpose of that video so you can see what it was doing]
It’ll point to the camera, not where the camera is facing.
What I want to have happen is the camera light will point in the direction where the camera is facing so that the player can see where they’re looking, in both water and air.
The problem I’m having is that, while I’m using attachments, I get one of the following:
Rotation is on the wrong axis when pivoting, or
Rotation is completely wrong
I’m trying to find the best way to do it so that other people know where the client is looking. I may have to resort to setting the local CFrame first, getting the position in world, then setting the world CFrame to what I need it to be. I’d prefer to not do this because that’s multiple different property sets which could cause issues with performance since it’s the serverside that has to set the positions, not client-side.