Skip to main content
Branch: Development

VirtualEntity

Hierarchy

  • WorldObject
    • VirtualEntity

Index

Constructors

publicconstructor

  • new VirtualEntity(group: VirtualEntityGroup, position: Vector3, streamingDistance: number, data?: Record<string, any>): VirtualEntity
  • Creates a new Virtual Entity

Properties

publicdimension

dimension: number

Object dimension.

Remarks

Check https://docs.altv.mp/articles/dimensions.html to understand how it works.

publicreadonlygroup

group: VirtualEntityGroup

Virtual Entity Group this entity belongs to

publicreadonlyid

id: number

publicpos

pos: Vector3

Object position.

publicreadonlyrefCount

refCount: number

Returns the ref count of the entity.

Remarks

It’s only available in debug-mode.

publicreadonlystreamingDistance

streamingDistance: number

Streaming range for the virtual entity

publicreadonlytype

type: BaseObjectType

Type of the object.

publicreadonlyvalid

valid: boolean

Object usability.

Returns

False if object is no longer usable.

publicvisible

visible: boolean

publicstaticreadonlyall

all: readonly VirtualEntity[]

Returns all Virtual Entity instances

Methods

publicdeleteMeta

  • deleteMeta(key: string): void
  • deleteMeta<K>(key: K): void

publicdeleteStreamSyncedMeta

  • deleteStreamSyncedMeta(key: string): void
  • deleteStreamSyncedMeta<K>(key: K): void
  • Removes the specified key and the data connected to that specific key.

publicdeleteSyncedMeta

  • deleteSyncedMeta(key: string): void
  • deleteSyncedMeta<K>(key: K): void
  • Removes the specified key and the data connected to that specific key.

publicdestroy

  • destroy(): void
  • Removes the object from the world.

publicgetMeta

  • getMeta<K>(key: Exclude<K, never>): unknown
  • getMeta<K>(key: K): undefined | ICustomBaseObjectMeta[K]
  • getMeta<V>(key: string): undefined | V
  • Type parameters

    • K: string

publicgetMetaDataKeys

  • getMetaDataKeys(): readonly string[]

publicgetStreamSyncedMeta

  • getStreamSyncedMeta<K>(key: Exclude<K, never>): unknown
  • getStreamSyncedMeta<K>(key: K): undefined | ICustomVirtualEntityStreamSyncedMeta[K]
  • getStreamSyncedMeta<V>(key: string): undefined | V
  • Gets a value using the specified key.


    Type parameters

    • K: string

publicgetStreamSyncedMetaKeys

  • getStreamSyncedMetaKeys(): readonly string[]

publicgetSyncedMeta

  • getSyncedMeta<K>(key: Exclude<K, never>): unknown
  • getSyncedMeta<K>(key: K): undefined | ICustomBaseObjectSyncedMeta[K]
  • getSyncedMeta<V>(key: string): undefined | V
  • Gets a value using the specified key.


    Type parameters

    • K: string

publicgetSyncedMetaKeys

  • getSyncedMetaKeys(): readonly string[]

publichasMeta

  • hasMeta(key: string): boolean
  • hasMeta<K>(key: K): boolean

publichasStreamSyncedMeta

  • hasStreamSyncedMeta(key: string): boolean
  • hasStreamSyncedMeta<K>(key: K): boolean
  • Determines whether contains the specified key.

publichasSyncedMeta

  • hasSyncedMeta(key: string): boolean
  • hasSyncedMeta<K>(key: K): boolean
  • Determines whether contains the specified key.

publicsetMeta

  • setMeta<K>(key: K, value: InterfaceValueByKey<ICustomBaseObjectMeta, K, unknown, void>): void
  • setMeta<K>(key: K, value: ICustomBaseObjectMeta[K]): void
  • setMeta<V, K>(key: K, value: InterfaceValueByKey<ICustomBaseObjectMeta, K, V, void>): void
  • Type parameters

    • K: string

publicsetStreamSyncedMeta

  • setStreamSyncedMeta<K>(key: K, value: InterfaceValueByKey<ICustomVirtualEntityStreamSyncedMeta, K, unknown, void>): void
  • setStreamSyncedMeta<K>(key: K, value: ICustomVirtualEntityStreamSyncedMeta[K]): void
  • setStreamSyncedMeta<V, K>(key: K, value: InterfaceValueByKey<ICustomVirtualEntityStreamSyncedMeta, K, V, void>): void
  • Stores the given value with the specified key.

    Remarks

    The given value will be shared with all clients in streaming range.


    Type parameters

    • K: string

publicsetSyncedMeta

  • setSyncedMeta<K>(key: K, value: InterfaceValueByKey<ICustomBaseObjectSyncedMeta, K, unknown, void>): void
  • setSyncedMeta<K>(key: K, value: ICustomBaseObjectSyncedMeta[K]): void
  • setSyncedMeta<V, K>(key: K, value: InterfaceValueByKey<ICustomBaseObjectSyncedMeta, K, V, void>): void
  • Stores the given value with the specified key.

    Remarks

    The given value will be shared with all clients.


    Type parameters

    • K: string

publicstaticgetByID

  • getByID(type: BaseObjectType, id: number): null | BaseObject
  • Gets the base object with the given type and id