CyberM.camera.attach()
Reattaches the camera to the body.
Attaches the CyberM camera to a game entity using the supplied local offset and rotation. Camera ownership is local to the resource generation; attaching replaces the resource's previous detached/attached camera state.
Returns
- true on success, otherwise false
- reason for the refusal
Registered in ResourceHost.cpp as LuaCameraAttach (line 6750).
CyberM.camera.detach(x, y, z)
Detaches the camera from the body, with an offset in the body's own space.
Detaches the CyberM camera from its target while retaining a controllable camera view. It does not synchronize a camera to other players and is automatically restored during resource cleanup.
Parameters
- xnumberrequired
- ynumberrequired
- znumberrequired
Returns
- true on success, otherwise false
- reason for the refusal
Registered in ResourceHost.cpp as LuaCameraDetach (line 6749).
CyberM.camera.project(position)
Projects a world point into normalized WebUI viewport coordinates.
Uses REDengine's active camera projection. (0,0) is the top-left and (1,1) the bottom-right. onScreen is false for points behind the view or beyond the viewport.
Parameters
- positiontable { x, y, z }required
Returns
- table { x, y, depth, distance, onScreen }, or nil
- reason
Registered in ResourceHost.cpp as LuaCameraProject (line 6753).
CyberM.camera.setFov(degrees)
Sets the field of view, in degrees.
Changes the field of view of the camera currently controlled by CyberM. The value is validated by the native backend and applies only to this client's presentation.
Returns
- true on success, otherwise false
- reason for the refusal
Registered in ResourceHost.cpp as LuaCameraFieldOfView (line 6751).
CyberM.camera.thirdPerson(enabled, [distance], [height])
Switches the view to third person.
Turning it off restores the view the game had before the call, rather than some default.
Parameters
- enabledbooleanrequired
- distancenumberoptional
- heightnumberoptional
Returns
- true on success, otherwise false
- reason for the refusal
Example
CyberM.camera.thirdPerson(true, 2.5, 1.7)
Registered in ResourceHost.cpp as LuaCameraThirdPerson (line 6748).
CyberM.camera.view()
Where the view is: position, forward vector, field of view.
Returns the latest game-thread camera snapshot used by projection and presentation APIs. It is a same-client read and may return nil, reason while the game camera is unavailable.
Returns
- position (x, y, z)
- forward (x, y, z)
- field of view
Registered in ResourceHost.cpp as LuaCameraView (line 6752).