Ad
Log in to vote
0

Camera flipping around when rotated?

Asked by 1 month 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)

Hi.

Looks like you're using an ad blocker.

That's fine...

No, it really is.

Just, I mean, we put a lot of work into this site, you know?

It would be really really appreciated if you would turn off your ad blocker for our website...

We tried really hard to make our ads as unobtrusive as possible.

If you really hate ads, would you consider a $2 donation via Patreon?

Here's the link.

We love you. We hope you love us too.

.

..

...

Now back to your regularly scheduled Scripting Helpers....

...

..

.

1 answer

Log in to vote
0
Answered by
RubenKan 1832 Community Moderator
1 month 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 2 — 1mo
0
Oh, or do you mean modifying the existing CameraScript? elijahlorden 2 — 1mo
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 2 — 1mo
Ad

Answer this question



Ad