Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Camera flipping around when rotated?

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

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.

3 comments

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.

0

Oh, or do you mean modifying the existing CameraScript?

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.