I made an RTS camera module

The most important functions are in the description!

Basically, it allows you to make an RTS camera and manipulate it easier.

Here’s an example script

local CurrentCamera = workspace.CurrentCamera

local Module = require(script:WaitForChild("CameraModule_RTS"))

local Sensitivity = 10
local Zoom = 40
wait(2)
Module:SetZoom(Zoom)
Module:SetCameraAngle(10,0)
while wait(0.03) do
	local Y = Sensitivity * 0.03
	Module:UpdateCameraAngleInDegrees(0,Y)
	Module:Update()
end

Important functions

PrintProperties() - Prints and returns Properties

Update() - Sets your camera position, orientation, relative to stored position and xrotation, with yrotation.

SetCameraAngles(X,Y) - Sets your camera angle to X and Y in common degrees

SetCameraPosition(X,Y,Z) - Sets your camera point position to X , Y and Z

UpdateCameraAngleInDegrees(X,Y) - Adds X and Y to stored x and y rotations.

SetZoom(Zoom) - Sets zoom value

SetScriptable(IsScriptable) - Allows to ignore a warning, if the camera type isn’t scriptable

SetXClamp(Xmin,Xmax)) - Sets max and min angles for x axis in the camera

SetYClamp(Ymin,Ymax)) - Sets max and min angles for y axis in the camera, but it requires YRotationLimit to be true.

To set YRotationLimit to true or false, use
SetYAngleRotationLimit(IsLimit) function.

Less important functions

GetActualZoomWithWhiteList(WhiteList) – has no actual functionality yet, returns ZoomOut value for now

Move functions

MoveForward(deltaTime,Speed) - moves camera point forward on z and x axis (y axis is being ignored)

MoveBack(deltaTime,Speed) - moves camera point backwards on z and x axis (y axis is being ignored)

MoveRight(deltaTime,Speed) - moves camera point to the right on z and x axis (y axis is being ignored)

MoveLeft(deltaTime,Speed) - moves camera point to the left on z and x axis (y axis is being ignored)

MoveUp(deltaTime,Speed) - moves camera point up on y axis from world’s orientation

MoveDown(deltaTime,Speed) - moves camera point down on y axis from world’s orientation

MoveUpRelativeToCamera(deltaTime,Speed) - moves camera point up on y axis from camera’s orientation

MoveDownRelativeToCamera(deltaTime,Speed) - moves camera point down on y axis from camera’s orientation

5 Likes

I dont know How it works ??? i dont remember

I did not understand the warnings very well, or how to activate it. However, I did this in a LocalScript

local CurrentCamera = workspace.CurrentCamera
local Module = require(script:WaitForChild("CameraModule_RTS"))
local Sensitivity = 10
local Zoom = 40

wait(2)

Module:SetZoom(Zoom)
Module:SetCameraAngle(10,0)
Module:SetCameraObject(CurrentCamera)
Module:SetScriptable()

while wait(0.03) do
local Y = Sensitivity * 0.03
Module:UpdateCameraAngleInDegrees(0,Y)
Module:Update()
end

Sorry for the bump but do you think this would be possible to modify to support movement via mouse dragging or should I only stick to WASD keys for movement.

But it already does… Why would you think that it doesn’t work like with key inputs?

Doesn’t seem to work for me :confused:
//////////////////////