Object
@vimp-mp/types 2.0.1Server-known object. It may be known before/after streaming into a local GTA entity.
interface ObjectMembers
alpha
readonly alpha: numberAuthoritative cached alpha for remote objects.
dimension
readonly dimension: numberClient-side dimension value associated with this wrapper.
forwardVector
readonly forwardVector: Vec3Direction vector derived from the object's current rotation.
handle
readonly handle: numberGTA entity handle, or 0 while known but not streamed.
heading
readonly heading: numberCached or live heading in degrees.
id
readonly id: numberClient-local 0-based wrapper id, unique per entity type and reused after destroy. Use remoteId for server/network state.
isAlive
readonly isAlive: booleanTrue while the remote object exists in multiplayer state. Use handle !== 0 for local streamed visibility.
isExists
readonly isExists: booleanAlias of isAlive for object lifecycle existence.
isRemote
readonly isRemote: booleanWhether this wrapper represents a server-owned object.
model
readonly model: numberGTA object model hash.
position
readonly position: Vec3Cached or live world position, depending on streaming state.
remoteId
readonly remoteId: number | nullServer object id for remote objects; null for local-only objects. Zero is a valid remote id.
rotation
readonly rotation: Vec3Cached or live world rotation in degrees.
attachTo
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): voidAttaches the object to a GTA entity handle with explicit transforms.
attachToEntity
attachToEntity(target: { handle: number }, boneIndex: number, offset: Vec3, rotation: Vec3, p9: boolean, useSoftPinning: boolean, collision: boolean, isPed: boolean, vertexIndex: number, fixedRot: boolean): voidAttaches the object to another VIMP entity wrapper.
destroy
destroy(): booleanDestroys local-only objects. Returns false for remote objects or already-destroyed wrappers.
detach
detach(useDetachVelocity: boolean, collision: boolean): voidDetaches the native object from its current parent entity.
freezePosition
freezePosition(freeze: boolean): voidFreezes or unfreezes the native object when streamed.
getBoneIndexByName
getBoneIndexByName(boneName: string): numberResolves a named bone on the native object, or returns -1.
getOffsetFromInWorldCoords
getOffsetFromInWorldCoords(offsetX: number, offsetY: number, offsetZ: number): Vec3Converts an object-local offset into world coordinates.
getSpeed
getSpeed(): numberReturns the object's current speed in metres per second.
getWorldPositionOfBone
getWorldPositionOfBone(boneIndex: number): Vec3Returns the world position of a native object bone.
isAttachedTo
isAttachedTo(entity: number): booleanReports whether the native object is attached to a GTA entity handle.
isPlayingAnim
isPlayingAnim(dictionary: string, name: string, taskFlag: number): booleanReports whether the object entity is playing the requested animation.
resetAlpha
resetAlpha(): voidRestores the native object's default opacity.
setAlpha
setAlpha(alpha: number): voidSets the native object's opacity.
setCollision
setCollision(collision: boolean, keepPhysics: boolean): voidEnables or disables collision on the native object when streamed.
setCoords
setCoords(xPos: number, yPos: number, zPos: number, xAxis: boolean, yAxis: boolean, zAxis: boolean, clearArea: boolean): voidMoves the native object using GTA's axis and area-clear flags.
setDimension
setDimension(dimension: number): voidChanges the client-side dimension value associated with this wrapper.
setHeading
setHeading(heading: number): voidUpdates the cached heading and the native object when streamed.
setInvincible
setInvincible(invincible: boolean): voidEnables or disables damage on the native object when streamed.
setModel
setModel(model: string | number): voidReplaces a local object model or updates a remote object's cached model.
setPosition
setPosition(position: Vec3): voidUpdates the cached position and moves the native object when streamed.
setRotation
setRotation(rotation: Vec3): voidUpdates the cached rotation and the native object when streamed.
setVisible
setVisible(visible: boolean): voidShows or hides the native object when streamed.