NoClip
constNoClip:object
Defined in: client/api.d.ts:1986
This machine’s free camera, and what happens to the player’s body while it is flying.
The view is a bodyless anchor entity made the active camera through the engine’s own view system, so nothing is ever asked to sweep against the world. In body mode the player’s entity is taken out of the physical world and placed at the camera each frame – the pair a FiveM noclip composes out of SetEntityCollision and SetEntityCoordsNoOffset.
Client-only, and nothing here is an order another machine takes. It is not invisible to the session either: in body mode the thing being flown is the entity this client replicates, so the other players watch the flier go. In camera mode the body never moves.
The game’s controls are held for as long as the flight lasts, whichever side is driving. The map editor (MapEditor) flies the same one camera: a flight in progress ends when the editor opens, and enable refuses while it is open.
Type Declaration
Section titled “Type Declaration”disable()
Section titled “disable()”disable(
options?):void
Ends the flight, hands the view back and puts the body back into the physical world. Does nothing when no flight is running.
Parameters
Section titled “Parameters”options?
Section titled “options?”keepPosition leaves the body where the camera stopped, and is the default. False puts it back where it took off from, facing the way it was. Neither means anything in camera mode.
keepPosition?
Section titled “keepPosition?”boolean
Returns
Section titled “Returns”void
Nothing. noclipChanged reports the end with reason script.
enable()
Section titled “enable()”enable(
options?):"enabled"|"alreadyActive"|"noCamera"|"cameraBusy"
Starts flying. The camera begins where the player was looking, so this reads as stopping rather than as a cut.
Parameters
Section titled “Parameters”options?
Section titled “options?”mode decides what happens to the player. body, the default, carries them: they pass through geometry, the world streams around them, the other players see them fly, and they land wherever the flight ends. camera leaves the body where it stands and touches nothing about its physics. A name that is neither is rejected rather than guessed at.
input is whether this machine’s keyboard and mouse fly the camera – on the keys the game’s own photo mode is bound to in the controls menu (forward, back, left, right, jump to rise, crouch to sink, fast movement to boost), read through the active keyboard layout so AZERTY and the like work as the game does; Alt to crawl, mouse to turn. On by default; off, drive it with move.
speed is metres a second at rest, 0.05 to 400 and 12 by default. fov is the vertical field of view in degrees, up to 140; omitted, the view keeps the game’s.
number
input?
Section titled “input?”boolean
"body" | "camera"
speed?
Section titled “speed?”number
Returns
Section titled “Returns”"enabled" | "alreadyActive" | "noCamera" | "cameraBusy"
enabled when the flight started. alreadyActive when one was already running – the options are not re-applied. noCamera when there is no level to spawn the camera’s anchor into. cameraBusy when the map editor holds the camera.
focus()
Section titled “focus()”focus(
target,distance?):boolean
Turns to face a point and then stands back from it, which is what framing an object wants.
Parameters
Section titled “Parameters”target
Section titled “target”The world-space point to look at.
distance?
Section titled “distance?”number
How far back to stand from it, in metres, from 1 to 4096. 6 by default.
Returns
Section titled “Returns”boolean
True when the camera moved; false when no flight is running.
getForward()
Section titled “getForward()”getForward():
Vector3|null
The unit direction the camera is looking along.
Returns
Section titled “Returns”Vector3 | null
Its view direction, or null when no flight is running.
getFov()
Section titled “getFov()”getFov():
number
The vertical field of view in degrees the view was last asked for, which is not what came back: getState reports the rendered one separately as renderedFov.
Returns
Section titled “Returns”number
The requested field of view.
getPosition()
Section titled “getPosition()”getPosition():
Vector3|null
Where the camera is, in world-space metres.
Returns
Section titled “Returns”Vector3 | null
Its position, or null when no flight is running.
getRotation()
Section titled “getRotation()”getRotation(): {
pitch:number;yaw:number; } |null
How the camera is aimed, in degrees. Two angles rather than a quaternion: that is what flying with a mouse produces, and it keeps the horizon level for free.
Returns
Section titled “Returns”{ pitch: number; yaw: number; } | null
Its angles, or null when no flight is running.
getSpeed()
Section titled “getSpeed()”getSpeed():
number
Metres a second the camera flies at rest, before boost or crawl scales it.
Returns
Section titled “Returns”number
The speed, or 0 when there is no application to ask.
getState()
Section titled “getState()”getState():
NoClipState|null
Everything about the flight in one read, rather than six calls that could each land on a different frame.
Returns
Section titled “Returns”NoClipState | null
The state, or null when no flight is running.
isActive()
Section titled “isActive()”isActive():
boolean
Whether a flight is running at this machine.
Returns
Section titled “Returns”boolean
True while the free camera has the view.
isInputEnabled()
Section titled “isInputEnabled()”isInputEnabled():
boolean
Whether this machine’s own keyboard and mouse are flying the camera.
Returns
Section titled “Returns”boolean
True while the built-in driver is on.
lookAt()
Section titled “lookAt()”lookAt(
point):boolean
Turns the camera to face a point, leaving it where it is.
Parameters
Section titled “Parameters”The world-space point to face.
Returns
Section titled “Returns”boolean
True when the camera turned; false when no flight is running.
move()
Section titled “move()”move(
input,deltaSeconds):boolean
Moves the camera by one frame of flight the resource resolved itself. Refused while the built-in driver is on, so the two cannot both integrate the same frame.
Parameters
Section titled “Parameters”One frame of flight. forward, strafe and lift are -1..1 along the view’s heading, its right and world up – lift is along world up rather than the view’s, so rising and falling stay vertical while looking down. yaw and pitch are this frame’s turn in degrees. boost multiplies the speed by six and crawl divides it by five, as Shift and Alt do.
boost?
Section titled “boost?”boolean
crawl?
Section titled “crawl?”boolean
forward?
Section titled “forward?”number
number
pitch?
Section titled “pitch?”number
strafe?
Section titled “strafe?”number
number
deltaSeconds
Section titled “deltaSeconds”number
How long this frame is. Anything over 0.1 is treated as 0.1, so a stalled frame does not launch the camera across the map.
Returns
Section titled “Returns”boolean
True when the frame was applied. False when no flight is running and when the built-in driver has the camera.
projectToScreen()
Section titled “projectToScreen()”projectToScreen(
point): {x:number;y:number; } |null
Where a world point lands on the camera’s frame, in the same normalized device coordinates rayThroughScreen takes.
Parameters
Section titled “Parameters”The world-space point to project.
Returns
Section titled “Returns”{ x: number; y: number; } | null
Its place on the frame, or null when no flight is running and when the point is behind the camera.
rayThroughScreen()
Section titled “rayThroughScreen()”rayThroughScreen(
x,y):Vector3|null
The world direction through a point on the camera’s near plane.
Normalized device coordinates rather than pixels, because the mod does not own the back buffer’s size. Pair it with World.raycast from getPosition() to find what is under a point of the frame.
Parameters
Section titled “Parameters”number
Across the frame, -1 at the left edge and +1 at the right.
number
Up the frame, -1 at the bottom and +1 at the top.
Returns
Section titled “Returns”Vector3 | null
A unit direction, or null when no flight is running.
setFov()
Section titled “setFov()”setFov(
degrees):void
Sets the camera’s lens.
Parameters
Section titled “Parameters”degrees
Section titled “degrees”number
The vertical field of view, clamped to 20..140.
Returns
Section titled “Returns”void
Nothing.
setInputEnabled()
Section titled “setInputEnabled()”setInputEnabled(
enabled):void
Hands the camera between the built-in driver and the resource, mid-flight. The game’s controls stay held either way: the choice is who flies the camera, not whether the player can walk.
Parameters
Section titled “Parameters”enabled
Section titled “enabled”boolean
True to let this machine’s keyboard and mouse fly the camera, false to leave it to move.
Returns
Section titled “Returns”void
Nothing.
setPose()
Section titled “setPose()”setPose(
position,forward):boolean
Places and aims the camera in one go.
Parameters
Section titled “Parameters”position
Section titled “position”Where to put the camera, in world-space metres.
forward
Section titled “forward”The direction to aim it along. Need not be normalized; a direction of no length is ignored.
Returns
Section titled “Returns”boolean
True when the camera took the pose; false when no flight is running.
setPosition()
Section titled “setPosition()”setPosition(
position):boolean
Puts the camera somewhere else without turning it.
Parameters
Section titled “Parameters”position
Section titled “position”Where to put it, in world-space metres. A non-finite position is ignored.
Returns
Section titled “Returns”boolean
True when the camera took the position; false when no flight is running.
setRotation()
Section titled “setRotation()”setRotation(
rotation):boolean
Aims the camera without moving it.
Parameters
Section titled “Parameters”rotation
Section titled “rotation”The angles to take, in degrees. Either may be left out to keep the one the camera has. Yaw wraps to -180..180 and pitch is clamped to -89..89.
pitch?
Section titled “pitch?”number
number
Returns
Section titled “Returns”boolean
True when the camera took the angles; false when no flight is running.
setSpeed()
Section titled “setSpeed()”setSpeed(
metresPerSecond):void
Sets how fast the camera flies. Kept across flights, so a resource can set it once.
Parameters
Section titled “Parameters”metresPerSecond
Section titled “metresPerSecond”number
The new speed, clamped to 0.05..400.
Returns
Section titled “Returns”void
Nothing.