Camera Model Orientation is a plugin that creates a Camera Model that can be used to create menus and more. As of now itâs only a model and you will need to add your own code.
We just added two custom functions that you can use to interact with the cameras.
SetAsCurrentCamera() â Local Function (Cannot be used with Server Scripts) ResetCamera() â Local Function (Cannot be used with Server Scripts)
in order to access this functions Require the module script inside the camera.
Script example:
local userInput = game:GetService('UserInputService')
local cameraModel = workspace.CameraModel
local cameraFunctions = require(cameraModel.CameraFunctions)
local active = false
userInput.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.E then
if not active then
active = true
cameraFunctions.SetAsCurrentCamera()
else
active = false
cameraFunctions.ResetCamera()
end
end
end)
I only assumed it interacted with the normal camera because the example code you provided is extremely vague on the practical functionality of the model.
That code can be used to switch the current camera to the one you created via the plugin. This is usefull to create fast cutscenes or point the camera to a precise direction.
And you can choose the direction by pointing with the Studio Camera and pressing the Add New Camera button. It will add a camera to the current camera Position. This helps with getting the right angle and orientation.
local CameraFunctions = {}
local cameraModel = script.Parent
local CurrentCamera = workspace.CurrentCamera
local plr = game.Players.LocalPlayer
CameraFunctions.SetAsCurrentCamera = function() -- Client function, can only be run via clients or local scripts.
CurrentCamera.CFrame = cameraModel.CFrame * CFrame.Angles(0,math.rad(180),0)
CurrentCamera.CameraType = Enum.CameraType.Scriptable
end
CameraFunctions.ResetCamera = function() -- Client function, can only be run via clients or local scripts.
CurrentCamera.CameraSubject = plr.Character:FindFirstChild('Humanoid')
CurrentCamera.CameraType = Enum.CameraType.Custom
end
return CameraFunctions
This is a bit of bloat for something that would be present in every camera, and I still donât understand the point of this as you can still achieve this using CameraUtil and writing minimal code to manage the network of cameras.
Sure it is, itâs also possible with nothing at all too.
But having an actual visible camera in your game keeps it easier to understand where every camera is and you can change the position of it as you like without having to change the code everytime.
This plugin itâs not supposed to replace any big modules scripts or anything, itâs called lite for a reason.
CameraUtil has a function to set the cameras position to a part, which I utilize heavily in my games, because I simply position where I want a part to be at and integrate it with my camera system. That accomplishes the same thing as âmoving the camera without changing the codeâ because you can quite literally just use the move tool on the camera part.
Using that method is even more lightweight than this plugin, because it doesnât tween, doesnât cause extra computing power from the mesh, and doesnât get held up by a tween. All you need is a single anchored part and you can just call 1 function on the module. With this though, you have to require each seperate module from each individual camera, which is very inefficient.
Considering I can just call a single function over having to install a plugin, position my camera, and write some code to require a bunch of different modules, Iâd rather just place a part and call 1 function, with the added benefits of camera shaking, a built in cutscene system, and a lot of functions other than just snapping the position.
Not to mention, this script is horrible for performance!
local billboard = script.Parent.BillboardGui
local mesh = script.Parent
while wait() do
if game.Instance then
mesh.Transparency = 1
billboard.Enabled = false
end
end
This doesnât even destroy itself, so if you have multiple cameras, they all contain a script that has a constant background loop which makes the camera invisible even though it should only be called once.