💡SimObject

General game-object.

Examples:

Objects Iteration:

for (local i = SimObject.GetHead(); i; i = i.GetNext())
{
    // Do something...
}

Properties:

Static Functions:

.Create

SimObject.Create(model: Hash, coords: Vector3, rotation: Vector3): SimObject

Argument
Type
Description

model

Hash

-

coords

Vector3

Position of new Object

rotation

Vector3

Rotation of new Object

Returns SimObject when successfully created.

.GetHead

SimObject.GetHead(): SimObject

Returns first SimObject in ObjectsTree.

.GetNext

SimObject.GetNext(): SimObject

Returns next SimObject from ObjectsTree.

Functions:

.SetDestroyOnUnload

SimObject.SetDestroyOnUnload(toggle: boolean)

Argument
Type
Description

toggle

boolean

-

You can toggle if the current SimObject should be destroyed when script gets unloaded.

When you create any SimObject by default it will be set to be destroyed on unload, but you can override it by calling this function with toggle value to false.

.Destroy

SimObject.Destroy()

Destroys a SimObject. Please note SimObject will not become null.

.Restore

SimObject.Restore()

Restores all suspended components.

.Suspend

SimObject.Suspend()

Suspends all components. Note: some certain Objects will need to be suspend each OnGameUpdate.

.GetName

SimObject.GetName(): Hash

Returns a SimObject name as hash.

.GetPropertyName

SimObject.GetPropertyName(): Hash

Returns a SimObject property name as hash, this is basically the model hash you use for creating SimObject.

.GetType

SimObject:GetType(): SimObjectType

.GetPosition

SimObject.GetPosition(): Vector3

.SetPosition

SimObject.SetPosition(coords: Vector3)

Argument
Type
Description

coords

Vector3

World coordinates

.GetRotation

SimObject.GetRotation(): Vector3

.SetRotation

SimObject.SetRotation(euler: Vector3)

Argument
Type
Description

euler

Vector3

Rotation in euler

Attachment Functions:

.GetAttachmentCount

SimObject.GetAttachmentCount(): integer

Returns count of attached SimObjects to current SimObject.

.GetAttachments

SimObject.GetAttachments(): array[SimObject]

Returns array of SimObjects that are attached to current SimObject.

Last updated

Was this helpful?