Skip to content
KCKingdoms Connected Scripting APIScripting guides and API
Global objectClient APIGenerated

NoClip

const NoClip: 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.

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.

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.

boolean

void

Nothing. noclipChanged reports the end with reason script.

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.

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

boolean

"body" | "camera"

number

"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(target, distance?): boolean

Turns to face a point and then stands back from it, which is what framing an object wants.

Vector3

The world-space point to look at.

number

How far back to stand from it, in metres, from 1 to 4096. 6 by default.

boolean

True when the camera moved; false when no flight is running.

getForward(): Vector3 | null

The unit direction the camera is looking along.

Vector3 | null

Its view direction, or null when no flight is running.

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.

number

The requested field of view.

getPosition(): Vector3 | null

Where the camera is, in world-space metres.

Vector3 | null

Its position, or null when no flight is running.

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.

{ pitch: number; yaw: number; } | null

Its angles, or null when no flight is running.

getSpeed(): number

Metres a second the camera flies at rest, before boost or crawl scales it.

number

The speed, or 0 when there is no application to ask.

getState(): NoClipState | null

Everything about the flight in one read, rather than six calls that could each land on a different frame.

NoClipState | null

The state, or null when no flight is running.

isActive(): boolean

Whether a flight is running at this machine.

boolean

True while the free camera has the view.

isInputEnabled(): boolean

Whether this machine’s own keyboard and mouse are flying the camera.

boolean

True while the built-in driver is on.

lookAt(point): boolean

Turns the camera to face a point, leaving it where it is.

Vector3

The world-space point to face.

boolean

True when the camera turned; false when no flight is running.

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.

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.

boolean

boolean

number

number

number

number

number

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.

boolean

True when the frame was applied. False when no flight is running and when the built-in driver has the camera.

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.

Vector3

The world-space point to project.

{ 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(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.

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.

Vector3 | null

A unit direction, or null when no flight is running.

setFov(degrees): void

Sets the camera’s lens.

number

The vertical field of view, clamped to 20..140.

void

Nothing.

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.

boolean

True to let this machine’s keyboard and mouse fly the camera, false to leave it to move.

void

Nothing.

setPose(position, forward): boolean

Places and aims the camera in one go.

Vector3

Where to put the camera, in world-space metres.

Vector3

The direction to aim it along. Need not be normalized; a direction of no length is ignored.

boolean

True when the camera took the pose; false when no flight is running.

setPosition(position): boolean

Puts the camera somewhere else without turning it.

Vector3

Where to put it, in world-space metres. A non-finite position is ignored.

boolean

True when the camera took the position; false when no flight is running.

setRotation(rotation): boolean

Aims the camera without moving it.

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.

number

number

boolean

True when the camera took the angles; false when no flight is running.

setSpeed(metresPerSecond): void

Sets how fast the camera flies. Kept across flights, so a resource can set it once.

number

The new speed, clamped to 0.05..400.

void

Nothing.