ResetCameraPos: Difference between revisions
Jump to navigation
Jump to search
Document scripted camera API and events available from G1R:MP 0.1.3 |
Update 0.1.3 camera world placement, streaming safety and far camera test |
||
| Line 52: | Line 52: | ||
* Reset after a login transition must wait for your resource's confirmed spawn-completion signal, not merely authentication success. | * Reset after a login transition must wait for your resource's confirmed spawn-completion signal, not merely authentication success. | ||
* Only the owning resource may change an already controlled camera. Server and client ownership are distinct, even when resource names match; use one side consistently for a camera sequence. | * Only the owning resource may change an already controlled camera. Server and client ownership are distinct, even when resource names match; use one side consistently for a camera sequence. | ||
* Camera positions and | * Camera positions, paths and orbits have no distance limit relative to the local character. All world coordinates must remain finite and within -1,000,000 to 1,000,000 metres; the complete orbit extent is validated too. Camera control does not move the character, change replication distance, freeze input, or enable remote-player spectating. | ||
* Use [[resetCameraPos]] to restore gameplay view. Resource stop, disconnect and world/character changes release camera ownership; see [[onClientCameraReset]]. | * Use [[resetCameraPos]] to restore gameplay view. Resource stop, disconnect and world/character changes release camera ownership; see [[onClientCameraReset]]. | ||
* An applied acknowledgement confirms command handling, not | * An applied acknowledgement confirms command handling, not rendering or completion of world streaming. For a fresh read-back, request state after another frame or a short timer. See [[Scripted camera]] for distant scenes, lifecycle, acknowledgement and state-cache details. | ||
[[Category:Lua Functions]] | [[Category:Lua Functions]] | ||
[[Category:Shared Functions]] | [[Category:Shared Functions]] | ||
[[Category:Camera Functions]] | [[Category:Camera Functions]] | ||
Latest revision as of 00:07, 9 September 2026
resetCameraPos
AVAILABLE FROM UPDATE 0.1.3
This function is available in G1R:MP 0.1.3 and later. The contract below includes the compatibility guarantees introduced in that update.
Releases this resource's scripted camera and restores the player's gameplay view, optionally blending.
Syntax
-- Client-side
number|false resetCameraPos([number blendMs = 0])
-- Server-side
bool resetCameraPos(int playerId [, number blendMs = 0])
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
playerId |
int |
yes | Server-side only: the connected player whose local camera receives the command. |
blendMs |
int |
no | Blend duration in milliseconds, from 0 to 10,000. Zero requests an immediate reset. |
Returns
Client-side: a positive requestId, or false when validation or queuing fails. Wait for onClientCameraCommandResult to learn the execution result. Server-side: true only means validated and queued for the connected player; false means rejected. A server return value is not a client acknowledgement.
Examples
Client-side example; wait for the indicated acknowledgement phase.
local resetRequest
addEventHandler("onClientCameraCommandResult", resourceRoot,
function(requestId, ok, phase, errorText)
if requestId ~= resetRequest then return end
if ok and phase == "reset" then
resetRequest = nil
outputDebugString("Player camera restored")
elseif not ok then
resetRequest = nil
outputDebugString("Camera reset failed: " .. tostring(errorText), 2)
end
end)
resetRequest = resetCameraPos(600)
Notes
- Available in client-side and server-side resource scripts. Equivalent PascalCase spelling:
ResetCameraPos. - Client success phase:
reset, after the restore completes, notapplied. - Only this resource's ownership is released; reset is not a way to seize another resource's camera or override a foreign cutscene.
- An in-progress movement may receive
cancelled. Interrupted reset requests can reporterror. Server-side also acceptsresetCameraPosition. - Reset after a login transition must wait for your resource's confirmed spawn-completion signal, not merely authentication success.
- Only the owning resource may change an already controlled camera. Server and client ownership are distinct, even when resource names match; use one side consistently for a camera sequence.
- Camera positions, paths and orbits have no distance limit relative to the local character. All world coordinates must remain finite and within -1,000,000 to 1,000,000 metres; the complete orbit extent is validated too. Camera control does not move the character, change replication distance, freeze input, or enable remote-player spectating.
- Use resetCameraPos to restore gameplay view. Resource stop, disconnect and world/character changes release camera ownership; see onClientCameraReset.
- An applied acknowledgement confirms command handling, not rendering or completion of world streaming. For a fresh read-back, request state after another frame or a short timer. See Scripted camera for distant scenes, lifecycle, acknowledgement and state-cache details.