Documentation

Want to improve the docs? Take a look at scripting-api-data!
Found a bug? jc3mp/bugs is a good place to let us know.

GameObject

Constructible This class can be instantiated from your script. You can find more information on the Constructor below. Auto Destroy To delete an instance of this class, use the `Destroy` function of this class. You can find the function definition below. Custom Properties You can extend instances of this class with your own properties.

Game Objects (Props)

Constructor

new GameObject(string model, Vector3f position, Vector3f rotation)

  • model: the model name (not hash!) of the object
  • position: the desired position of the GameObject
  • rotation: optional the desired rotation of the GameObject

Example

var gameobject = new GameObject('glowstick_yellow');

Properties

Name Type Description
position Vector3f the GameObject's position in the game world
rotation Vector3f the GameObject's rotation in the game world
networkId number read only the network id of this entity. It is not unique across different entities and will be re-assigned once this entity was destroyed
modelHash string read only model hash of the GameObject (TODO: reference to all hashes)
dimension number world dimension of the GameObject.

Functions

GameObject.ApplyForce(Vector3f direction, number deltaTime)

Applies a 3d-force to the GameObject

Parameter

Name Type Description
direction Vector3f force direction
deltaTime number delta time

Example

var object = new GameObject('glowstick_yellow');
object.ApplyForce(new Vector3f(100, 0, 0), 1);

GameObject.Destroy()

Destroys the GameObject

Stay informed

By becoming the newest member of our growing forums, we and hundreds of other players will always keep you up to date on everything JC3:MP related.