GuiTopDownCamera
GuiTopDownCamera
Description
Top-down camera used for UI. Provides a birds-eye view for players when they need to interact with the world from the UI (e.g. placing objects, modifying terrain).
Functions
- activate
- applyMovement
- createCameraNodes
- deactivate
- delete
- determineMapPosition
- getIsActive
- getMouseEdgeScrollingMovement
- getPickRay
- mouseEvent
- onInputModeChanged
- onMoveForward
- onMoveSide
- onRotate
- onTilt
- onZoom
- registerActionEvents
- removeActionEvents
- reset
- resetInputState
- setCameraPosition
- setEdgeScrollingOffset
- setMouseEdgeScrollingActive
- setTerrainRootNode
- update
- updateMovement
- updatePosition
activate
Description
Activate the camera and change the game's viewpoint to it.
Definition
activate()
Code
function GuiTopDownCamera:activate()
g_inputBinding:setShowMouseCursor( true )
self:onInputModeChanged( { g_inputBinding:getLastInputMode() } )
self:updatePosition()
self.previousCamera = g_cameraManager:getActiveCamera()
g_cameraManager:setActiveCamera( self.camera)
local x, _y, z = g_localPlayer:getPosition()
self:setCameraPosition(x, z)
self:registerActionEvents()
g_messageCenter:subscribe(MessageType.INPUT_MODE_CHANGED, self.onInputModeChanged, self )
self.isActive = true
end