0

I'm trying to invert the depth of the camera (multiplying the camera's CFrame by (0,0,0, -1,0,0,0,1,0,0,0,1). To my knowledge, the only way I can implement this is by setting the camera type to scriptable. Doing this, however, completely removes the player's ability to manipulate the camera, whether it be via mouse or arrow keys. I saw a video where someone inverted the camera while still having camera controls, but as of now they haven't responded to my question- how they did it. Is there a better way to do this? Am I missing something that's very clearly a fix?

I've tried using other camera types - custom, track, and follow- no difference.

--- LocalScript in StarterGui ---

workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable 
local char = game.Players.LocalPlayer.Character
local RunService = game:GetService("RunService")

RunService.Heartbeat:Connect(function()
    if math.random(1,50)==50 then -- This is just for randomly inverting the camera.
        workspace.CurrentCamera.CFrame = workspace.CurrentCamera.CFrame*CFrame.new(0,0,0,-1,0,0,0,1,0,0,0,1) -- r00, or the 4th number, is the one that inverts the depth.
        end
    end
) 
4
  • I'm not a Roblox user but it sounds like you need something like dynamic switching between camera types. Try an experiment where you make the camera scriptable, change the depth, then switch the camera type back to normal (user controlled) camera. Expected result: is that user can control camera but the depth remains inverted... PS: This logic might work better if the camera is a named variable. Commented Oct 4 at 8:29
  • Example... (1) Define a named camera: local myCamera = workspace.CurrentCamera and then make it scriptable: myCamera.CameraType = Enum.CameraType.Scriptable (2) Do the invert code part once, and immediately convert back to the type with "player's ability to manipulate the camera". I did not find such a specific CameraType in the docs.. source 1 and source 2. PS: check this: google.com/search?q=roblox+dynamically+change+camera+type Commented Oct 4 at 8:44
  • 1
    PPS: If switching doesn't work then get creative. One way is to see if its possible to use two cameras (or 2 viewports). One view has the same camera position but is also inverted. A starting point for 2 views is: Rendering a second camera into the player’s view?... Anyways a side note: If this "saw a video where someone inverted the camera" is not a normal Roblox feature then it might actually be rude to just ask for their code tricks. Maybe offer them a small payment in return for a short tutorial. Commented Oct 4 at 9:11
  • @VC.One - using a second camera worked, thank you for the suggestion! Commented Oct 4 at 17:25

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.