Skip to content

Object

@vimp-mp/types 2.0.1

Interface · Client API

Server-known object. It may be known before/after streaming into a local GTA entity.

ts
interface Object

Members

alpha

ts
readonly alpha: number

Authoritative cached alpha for remote objects.

dimension

ts
readonly dimension: number

Client-side dimension value associated with this wrapper.

forwardVector

ts
readonly forwardVector: Vec3

Direction vector derived from the object's current rotation.

handle

ts
readonly handle: number

GTA entity handle, or 0 while known but not streamed.

heading

ts
readonly heading: number

Cached or live heading in degrees.

id

ts
readonly id: number

Client-local 0-based wrapper id, unique per entity type and reused after destroy. Use remoteId for server/network state.

isAlive

ts
readonly isAlive: boolean

True while the remote object exists in multiplayer state. Use handle !== 0 for local streamed visibility.

isExists

ts
readonly isExists: boolean

Alias of isAlive for object lifecycle existence.

isRemote

ts
readonly isRemote: boolean

Whether this wrapper represents a server-owned object.

model

ts
readonly model: number

GTA object model hash.

position

ts
readonly position: Vec3

Cached or live world position, depending on streaming state.

remoteId

ts
readonly remoteId: number | null

Server object id for remote objects; null for local-only objects. Zero is a valid remote id.

rotation

ts
readonly rotation: Vec3

Cached or live world rotation in degrees.

attachTo

ts
attachTo(entity: number, boneIndex: number, xPos: number, yPos: number, zPos: number, xRot: number, yRot: number, zRot: number, useSoftPinning: boolean, collision: boolean, isPed: boolean, vertexIndex: number, fixedRot: boolean): void

Attaches the object to a GTA entity handle with explicit transforms.

attachToEntity

ts
attachToEntity(target: { handle: number }, boneIndex: number, offset: Vec3, rotation: Vec3, p9: boolean, useSoftPinning: boolean, collision: boolean, isPed: boolean, vertexIndex: number, fixedRot: boolean): void

Attaches the object to another VIMP entity wrapper.

destroy

ts
destroy(): boolean

Destroys local-only objects. Returns false for remote objects or already-destroyed wrappers.

detach

ts
detach(useDetachVelocity: boolean, collision: boolean): void

Detaches the native object from its current parent entity.

freezePosition

ts
freezePosition(freeze: boolean): void

Freezes or unfreezes the native object when streamed.

getBoneIndexByName

ts
getBoneIndexByName(boneName: string): number

Resolves a named bone on the native object, or returns -1.

getOffsetFromInWorldCoords

ts
getOffsetFromInWorldCoords(offsetX: number, offsetY: number, offsetZ: number): Vec3

Converts an object-local offset into world coordinates.

getSpeed

ts
getSpeed(): number

Returns the object's current speed in metres per second.

getWorldPositionOfBone

ts
getWorldPositionOfBone(boneIndex: number): Vec3

Returns the world position of a native object bone.

isAttachedTo

ts
isAttachedTo(entity: number): boolean

Reports whether the native object is attached to a GTA entity handle.

isPlayingAnim

ts
isPlayingAnim(dictionary: string, name: string, taskFlag: number): boolean

Reports whether the object entity is playing the requested animation.

resetAlpha

ts
resetAlpha(): void

Restores the native object's default opacity.

setAlpha

ts
setAlpha(alpha: number): void

Sets the native object's opacity.

setCollision

ts
setCollision(collision: boolean, keepPhysics: boolean): void

Enables or disables collision on the native object when streamed.

setCoords

ts
setCoords(xPos: number, yPos: number, zPos: number, xAxis: boolean, yAxis: boolean, zAxis: boolean, clearArea: boolean): void

Moves the native object using GTA's axis and area-clear flags.

setDimension

ts
setDimension(dimension: number): void

Changes the client-side dimension value associated with this wrapper.

setHeading

ts
setHeading(heading: number): void

Updates the cached heading and the native object when streamed.

setInvincible

ts
setInvincible(invincible: boolean): void

Enables or disables damage on the native object when streamed.

setModel

ts
setModel(model: string | number): void

Replaces a local object model or updates a remote object's cached model.

setPosition

ts
setPosition(position: Vec3): void

Updates the cached position and moves the native object when streamed.

setRotation

ts
setRotation(rotation: Vec3): void

Updates the cached rotation and the native object when streamed.

setVisible

ts
setVisible(visible: boolean): void

Shows or hides the native object when streamed.

VIMP developer documentation