Creator Guide
English
English
  • 🚩Introduction to OVERDARE
  • 🐤Get Started
    • OVERDARE App
    • OVERDARE Studio
  • 📌Policy
    • Community Guidelines
    • UGC Creation Guidelines
    • Guidelines on the External Use of UGC
    • Logo Usage Guidelines
    • Intellectual Property Rights Policy
    • Reporting Guidelines
    • Guidelines on Disputing Suspensions and Bans
    • Creator Payout Policy
    • Monetization Guidelines
  • 🏰Studio Manual
    • Studio Interface
    • Asset Import
    • Coordinate System
    • Game Settings
    • Studio Test Play
    • World Publish
    • Collaboration
    • Script Editor
    • Align Tool
    • Animation Editor
    • Material Manager
    • Collision Groups
    • Tag Editor
    • Payout Guideline
    • Object
      • Part
      • Model
      • Character
        • Humanoid Description
      • Camera
      • Physics
      • Lighting
      • Tool
      • VFX
      • Sound
      • GUI
  • 📝Script Manual
    • Script Overview
    • Basic Guide to Lua
    • Coding Style
    • Object Reference
    • Event
    • Server-Client Communication
    • BindableEvent
    • Value Objects
    • Mobile Input Handling
    • Tween
    • Breakpoint
    • Module Script
    • TPS Strafing System
    • Saving & Loading Data
    • Unity Developer Guide
  • 📚API Reference
    • Enums
      • ActuatorRelativeTo
      • AnimationPriority
      • AspectType
      • AssetTypeVerification
      • BorderMode
      • CameraMode
      • CameraType
      • ContextActionResult
      • CoreGuiType
      • DominantAxis
      • EasingDirection
      • EasingStyle
      • ForceLimitMode
      • HttpCompression
      • HttpContentType
      • HumanoidDisplayDistanceType
      • HumanoidStateType
      • KeyCode
      • Material
      • MaterialPattern
      • NormalId
      • ParticleEmitterShape
      • ParticleEmitterShapeInOut
      • ParticleEmitterShapeStyle
      • ParticleFlipbookLayout
      • ParticleFlipbookMode
      • ParticleOrientation
      • PartType
      • PlaybackState
      • RaycastFilterType
      • RollOffMode
      • RotationType
      • UserInputState
      • UserInputType
      • VelocityConstraintMode
    • DataTypes
      • BlendSpaceSampleSata
      • BrickColor
      • CFrame
      • Color3
      • ColorSequence
      • ColorSequenceKeypoint
      • Content
      • Enum
      • EnumItem
      • NumberRange
      • NumberSequence
      • NumberSequenceKeypoint
      • OverlapParams
      • PhysicalProperties
      • Ray
      • RaycastParams
      • RaycastResult
      • ScriptConnection
      • ScriptSignal
      • TweenInfo
      • Udim
      • Udim2
      • Vector2
      • Vector3
    • Classes
      • Animation
      • AngularVelocity
      • AnimationTrack
      • Animator
      • Atmosphere
      • Attachment
      • Backpack
      • BackpackItem
      • BasePart
      • BaseScript
      • Beam
      • BindableEvent
      • BlendSpace
      • BoolValue
      • Bone
      • Camera
      • CharacterMesh
      • CollectionService
      • Constraint
      • ContextActionService
      • CoreGui
      • DataStore
      • DataModel
      • DataStoreGetOptions
      • DataStoreIncrementOptions
      • DataStoreInfo
      • DataStoreKeyPages
      • DataStoreKeyInfo
      • DataStoreService
      • DataStoreListingPages
      • DataStoreSetOptions
      • FormFactorPart
      • Frame
      • Folder
      • GlobalDataStore
      • GuiBase2d
      • GuiButton
      • GuiObject
      • HttpService
      • Humanoid
      • HumanoidDescription
      • ImageButton
      • ImageLabel
      • InputObject
      • IntValue
      • LayerCollector
      • Instance
      • Light
      • Lighting
      • LinearVelocity
      • LocalScript
      • LuaSourceContainer
      • MaterialService
      • MaterialVariant
      • MeshPart
      • Model
      • ModuleScript
      • Mouse
      • OrderedDataStore
      • Pages
      • Part
      • ParticleEmitter
      • PhysicsService
      • Player
      • PlayerGui
      • Players
      • PlayerScripts
      • PointLight
      • PVInstance
      • ReplicatedStorage
      • RemoteEvent
      • ScreenGui
      • RunService
      • Script
      • ServerStorage
      • ServiceProvider
      • Skeleton
      • ServerScriptService
      • Sound
      • SoundService
      • SoundGroup
      • SpotLight
      • SpawnLocation
      • StarterCharacterScripts
      • StarterPack
      • StarterGui
      • StarterPlayer
      • StarterPlayerScripts
      • StringValue
      • SurfaceGui
      • SurfaceGuiBase
      • Team
      • Teams
      • TextLabel
      • TextButton
      • Tool
      • Trail
      • Tween
      • TweenService
      • TweenBase
      • UIAspectRatioConstraint
      • UserGameSettings
      • UserInputService
      • UserSettings
      • VectorForce
      • Workspace
      • WrapLayer
      • WorldRoot
      • WrapTarget
  • 🅰️OVERDARE Glossary
  • 📰Release Note
Powered by GitBook
On this page
  • Overview
  • Properties
  • How to Use the Camera
  • Modifying Camera Properties
  • Specifying Camera Type
  • Zooming In/Out Using FieldOfView and CFrame
  • Setting CameraSubject
  • Usage Examples
  • Top-down View Camera
  • TPS Camera
  1. Studio Manual
  2. Object

Camera

Overview

In a game, the camera provides a virtual viewpoint or perspective that allows players to observe and interact with the game world. Like a real-world camera, the game camera is a crucial tool that conveys the virtual environment, character actions, and events to the player, significantly influencing the game’s immersion and player enjoyment.

The camera goes beyond simply illuminating a scene; it uses various techniques such as movement and rotation to deliver a rich experience to the player. By emphasizing visual effects or dramatically showcasing specific events, it maximizes the game’s atmosphere and immersion. It is also a tool for effectively conveying various intended experiences, as well as interactions between characters and the environment.

The camera’s perspective can completely change the way a game is played. For example, in shooter games, the camera perspective can provide entirely different gameplay experiences:

  • Top-Down View (TOP-View): Simple aiming and shooting makes it suitable for fast-paced action.

  • TPS (Third-Person Perspective) / FPS (First-Person Perspective): Requires more precise vision and tactical play, enhancing immersion in combat.

Thus, the camera’s perspective is not just a visual tool but a critical element that can alter the core fun and strategy of a game.

Properties

속성
설명

CFrame

The camera’s position and orientation

Focus

The position and direction (of the subject) the camera is looking at

FieldOfView

The camera’s field of view (0 < FOV < 180)

ViewportSize

The size of the screen viewed through the camera

CameraSubject

The object the camera is focused on

CameraType

The type of camera

How to Use the Camera

Modifying Camera Properties

To directly adjust the camera, you need to edit the settings through scripting. While you can temporarily change values using the properties provided in the editor, actual camera settings must be applied through code (script) to reflect the changes.

Specifying Camera Type

The camera can currently only be manipulated for Custom and Scriptable types.

  • CFrame or Focus will not be modified unless the camera type is Scriptable, they are automatically determined by the default camera type.

  • Using the Scriptable type allows for more detailed adjustments and control.

Zooming In/Out Using FieldOfView and CFrame

FieldOfView is a key property for adjusting the camera’s field of view. It can be used to implement various custom camera effects:

  • Reducing FOV provides a Zoom-In effect.

  • Increasing FOV creates a **Wide-Angle **effect, similar to shooting with a wide-angle lens.

There are two ways to implement zooming in/out for your subject (e.g., the player):

  • Camera Position Adjustment: Moving the camera forward or backward to achieve the zoom effect.

  • FieldOfView Adjustment: Changing the field of view to implement zooming, which may introduce screen distortion.

Each method has its own characteristics, so the choice depends on the implementation goal. For example, to minimize distortion, use camera movement; for a stylish effect, use FOV adjustment.

🎥 Below are examples of zoom effects applied to the same subject using both methods:

  • Camera Movement Method: Natural zooming in and out.

    • When zooming in/out, objects closer to the camera scale more noticeably, while distant objects show little change in size.

  • FOV Adjustment Method: Distorted spatial perception when zooming in and out.

    • When zooming in/out, both near and distant objects scale similarly.

    • When zooming in, distant objects appear closer, creating a distorted effect.

  • If you look at the zoomed-in state, the size of the trees in the background behind the character doesn’t change much with the camera movement method, whereas with the FOV method, the trees in the background seem much larger and closer.

  • In the zoomed out state, you can see that the size change of the trees is not noticeable when the camera is moved, while the background size seem much smaller when the FOV is changed.

  • When the field of view is increased to a significant level, the screen exhibits severe distortion at the edges, similar to a fish-eye lens effect.

Setting CameraSubject

The CameraSubject property specifies the subject the camera focuses on.

  • By default, this is set to the player character.

  • You can assign specific objects as the subject to create various effects.

The camera movement that is locked to a Part position. The camera no longer follows the character.

Usage Examples

Top-down View Camera

The top-down view camera has the following characteristics:

  • Provides a bird’s-eye view, looking down at the character from above.

  • The camera follows the character at all times, keeping them centered or at a specific position on the screen.

  • The camera does not rotate regardless of the character’s movement, reducing fatigue or motion sickness.

  • Offers a wide field of view, suitable for tactical and strategic games.

  • However, it can lead to a monotonous game screen, which can be boring.

  • Typically, a player positioned higher on the screen can hide their character behind a wall, while it is difficult for a lower-positioned player to spot them.

To implement a top-down view, the following functionalities must be completed:

  • Using a Scriptable Camera to always track the player character’s position

  • Updating the camera’s position and viewing angle based on the character’s position

local Workspace = game:GetService("Workspace")
local RunService= game:GetService("RunService")
local Players = game:GetService("Players")

local Camera = Workspace.CurrentCamera
Camera.CameraType = Enum.CameraType.Scriptable

-- Acquiring the player character
local Character = Players.LocalPlayer.Character
Camera.CameraSubject = Character

-- Updating the Camera's CFrame Based on Character Position for each render step of the RunService
RunService.RenderStepped:Connect(function()
    local cameraPos = Character.HumanoidRootPart.Position + (Vector3.new(0, 0.5, 1) * 1200)	
    Camera.CFrame = CFrame.new(cameraPos.X, cameraPos.Y, cameraPos.Z) * CFrame.Angles(math.rad(-30), 0, 0)	
end)

TPS Camera

  • Offers a perspective close to first-person while allowing the player to see their own character.

  • The camera’s view remains clear even if the character’s body is blocked by objects, providing an open and unobstructed feel.

  • Provides a broader field of view compared to FPS cameras while supporting free camera rotation.

  • Provides long-distance visibility, allowing players to see distant objects clearly.

However,

  • The camera’s direction (or crosshair) may not align with the character’s direction. In shooting games, this requires additional handling to ensure accurate targeting.

  • (For example, while the crosshair may show an enemy clearly, the character’s position might be blocked by walls or objects, making it impossible to hit the target)

  • Players can hide behind walls, remaining hidden from their opponent’s view while still being able to see their opponent. This kind of information asymmetry can lead to unfair gameplay in PvP scenarios.

The TPS camera can be positioned by specifying an offset, similar to a top-down view camera. However, unlike a top-down view, the TPS camera requires camera rotation to be implemented.

  • Always acquire the player’s position with the scriptable camera

  • Move the camera based on character position and apply offset

  • When rotating the camera, treat the camera as if it is moving along the surface of a virtual sphere centered on the character

-- Getting the camera placed in Workspace and changing its type to Scriptable
local Workspace = game:GetService("Workspace")
local RunService= game:GetService("RunService")
local Players = game:GetService("Players")

local Camera = Workspace.CurrentCamera
local Mouse = Players.LocalPlayer:GetMouse()
Camera.CameraType = Enum.CameraType.Scriptable

-- Acquiring the player character
local Character = Players.LocalPlayer.Character
Camera.CameraSubject = Character

-- The distance away from the character and the offset position
local Distance = 200
local Offset = Vector2.new(50,20)

-- Handling mouse/touch related events for camera rotation
local bScreenTouched=false
local Pos_Touched=Vector2.zero
local CamLookVector=Camera.CFrame.LookVector

local function OnScreenTouched()
    if RunService:IsStudio() or (RunService:IsClient() and Mouse.X > Mouse.ViewSizeX/2) then
	Pos_Touched = Vector2.new(Mouse.X,Mouse.Y)	
	bScreenTouched = true
    end
end

local function OnScreenTouchEnded()
    bScreenTouched = false
end

Mouse.Button1Down:Connect(OnScreenTouched)
Mouse.Button2Down:Connect(OnScreenTouched)
Mouse.TouchStarted:Connect(OnScreenTouched)
Mouse.Button1Up:Connect(OnScreenTouchEnded) 
Mouse.Button2Up:Connect(OnScreenTouchEnded)
Mouse.TouchEnded:Connect(OnScreenTouchEnded)


local function CameraUpdate()
    Character =  Players.LocalPlayer.Character
    Camera.CameraSubject = Character
    -- Setting the camera's position to the character's pivot point, and moving backward along the camera's LookVector to maintain a certain distance.
    local rootpart = Character.HumanoidRootPart
    local pivot = rootpart.Position + Vector3.new(0, 20, 0)

    local cameraPos = pivot + (CamLookVector * -Distance)

    -- Calculating camera rotation when in screen touch state
    if bScreenTouched then	
	-- Calculating how much the touch has moved
        local delta = Vector2.new(Mouse.X - Pos_Touched.X, Mouse.Y - Pos_Touched.Y)			
        Pos_Touched = Vector2.new(Mouse.X, Mouse.Y)          	
       	
        -- Calculating rotation by touch movement
        local rotX = math.rad(-delta.Y*0.3)
        local rotY = math.rad(-delta.X*0.3)

        -- Calculating the current pivot CFrame
        local currentPivotCFrame = CFrame.lookAt(pivot, pivot + Camera.CFrame.LookVector * 100, rootpart.CFrame.UpVector)

        -- Applying rotation (Z-axis rotation is omitted)
        currentPivotCFrame = currentPivotCFrame * CFrame.Angles(rotX, rotY, 0)

        -- Calculating a new camera position via a rotated pivot
        cameraPos = currentPivotCFrame.Position + (currentPivotCFrame.LookVector * -Distance)
        CamLookVector = currentPivotCFrame.LookVector
    end
	
    -- Calculating the offset from the camera's Right and Up vectors to the reference axis
    local OFFSET = (Camera.CFrame.RightVector *Offset.X) + (Camera.CFrame.UpVector *Offset.Y)
    
    -- Applying camera position and orientation
    Camera.CFrame = CFrame.lookAt(cameraPos+OFFSET, pivot+OFFSET, rootpart.CFrame.UpVector)
    CamLookVector = Camera.CFrame.LookVector
end
RunService.RenderStepped:Connect(CameraUpdate)
PreviousHumanoid DescriptionNextPhysics

Last updated 1 month ago

🏰
Default Subject Screen
On the left, the camera is moved closer to the character. On the right, the camera's FOV is set to 30 degrees.
On the left, the camera is moved far away from the character. On the right, the camera's FOV is set to 120 degrees.
The camera's FOV is set to 160 degrees.
By changing the Subject to a red boxed Part, you can get a fixed camera effect at the cube position.
The default Custom type camera will have the character front and center in the camera, with the crosshair covered by the character.
To work as a TPS shooter, the center of the camera must be angled away from the character.