Ad
Log in to vote
0

Camera flipping around when rotated?

Asked by 1 year ago

I am attempting to create a camera with a full range of rotation (so the pitch is not clamped like the normal camera's is). I have run into an issue that I cannot find a way around, and there does not seem to be any information on how to fix it. I know, for a fact, that it is possible to overcome this issue, as I have seen other games where the issue was not present. Here is the code I am running to produce the issue:

workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
local t = 0
RunService:BindToRenderStep("ScrCameraUpdate", Enum.RenderPriority.Camera.Value, function()
    t = t + 0.5
    local targetPart = game.Players.LocalPlayer.Character.Head
    local lv = (targetPart.CFrame * CFrame.Angles(math.rad(t),0,0)).lookVector
    local offset = targetPart.Position - (lv*Camera.zoomOut)
    workspace.CurrentCamera.CoordinateFrame = CFrame.new(offset, targetPart.Position)
end)

1 answer

Log in to vote
0
Answered by
RubenKan 2636 Administrator
1 year ago

If you're talking about the camera not being able to go 360 degree up/down, you can simpfully fix this by setting the roll to 180' when the camera's angle reaches 180.

0
Could you please provide an example of how I would achieve this? I assume it would have something to do with extracting the angle measure from the final CFrame I set the camera to. elijahlorden 3 — 1y
0
Oh, or do you mean modifying the existing CameraScript? elijahlorden 3 — 1y
0
What I WANT is a camera for an environment which does not have a defined 'up' or 'down'. This is currently my only setback, and it is beginning to get very frustrating. elijahlorden 3 — 1y
Ad

Answer this question



Ad