Camera natives
Read and move the local player's camera.
Developer Preview. Scripting is live on Neighborly servers – everything on these pages works today. The API is young, so tell us what you need next on Discord.
Read and move the local player's camera.
Open in the natives browser Search all 199 natives at once.
GetCameraPosition
vector3 GetCameraPosition()Returns where the camera is.
Client only: it runs on the local player's PC and affects only their game. Other players don't see the result unless you tell the server.
Parameters
This native takes no parameters.
Returns
vector3 Camera position.
Example
RegisterCommand('campos', function()
local pos = GetCameraPosition()
local text = ('vector3(%.2f, %.2f, %.2f)'):format(pos.x, pos.y, pos.z)
AddChatMessage('Camera', text)
print(text)
end, false)GetCameraTarget
vector3 GetCameraTarget()Returns the camera's focus point.
Client only: it runs on the local player's PC and affects only their game. Other players don't see the result unless you tell the server.
Parameters
This native takes no parameters.
Returns
vector3 Point the camera looks at.
Example
RegisterCommand('markspot', function()
TriggerServerEvent('rtx_events:markSpot', GetCameraTarget())
end, false)FocusCameraOnSim
void FocusCameraOnSim(Sim sim, boolean? instant)Moves the camera to a Sim.
With instant the camera jumps; otherwise it glides like when clicking a Sim's portrait.
Parameters
| Parameter | Type | Description |
|---|---|---|
sim | Sim | The Sim. |
instant | boolean? | Jump instead of gliding. |
Returns
Nothing (void).
Example
RegisterNetEvent('rtx_wedding:vows', function(brideSim, groomSim)
FocusCameraOnSim(brideSim)
Wait(5000)
FocusCameraOnSim(groomSim)
end)FocusCameraOnLot
void FocusCameraOnLot(ZoneId zoneId)Moves the camera to show a whole lot.
Client only: it runs on the local player's PC and affects only their game. Other players don't see the result unless you tell the server.
Parameters
| Parameter | Type | Description |
|---|---|---|
zoneId | ZoneId | Zone id of the lot. |
Returns
Nothing (void).
Example
RegisterNetEvent('rtx_realty:showLot', function(zoneId)
FocusCameraOnLot(zoneId)
ShowNotification(('%s – %s'):format(GetLotName(zoneId), FormatMoney(GetLotValue(zoneId))), { title = 'For sale' })
end)FocusCameraOnCoords
void FocusCameraOnCoords(vector3 coords, number? zoom)Moves the camera to a point.
Client only: it runs on the local player's PC and affects only their game. Other players don't see the result unless you tell the server.
Parameters
| Parameter | Type | Description |
|---|---|---|
coords | vector3 | Point to look at. |
zoom | number? | 0.0 (close) to 1.0 (far). |
Returns
Nothing (void).
Example
RegisterNetEvent('rtx_stage:spotlight', function()
FocusCameraOnCoords(Config.StageCoords, 25.0)
ShowSubtitle('The show is about to begin!', 6000)
end)