Phaser API Documentation

  Version: 
addVerticesFromObj(key, [scale], [x], [y], [z], [rotateX], [rotateY], [rotateZ], [zIsUp])

Description:

This method will add the data from a triangulated Wavefront OBJ model file to this Mesh.

The data should have been loaded via the OBJFile:

this.load.obj(key, url);

Then use the same key as the first parameter to this method.

Multiple Mesh Game Objects can use the same model data without impacting on each other.

Make sure your 3D package has triangulated the model data prior to exporting it.

You can add multiple models to a single Mesh, although they will act as one when moved or rotated. You can scale the model data, should it be too small, or too large, to see. You can also offset the vertices of the model via the x, y and z parameters.

Parameters:

name type arguments Default description
key string

The key of the model data in the OBJ Cache to add to this Mesh.

scale number <optional> 1

An amount to scale the model data by. Use this if the model has exported too small, or large, to see.

x number <optional> 0

Translate the model x position by this amount.

y number <optional> 0

Translate the model y position by this amount.

z number <optional> 0

Translate the model z position by this amount.

rotateX number <optional> 0

Rotate the model on the x axis by this amount, in radians.

rotateY number <optional> 0

Rotate the model on the y axis by this amount, in radians.

rotateZ number <optional> 0

Rotate the model on the z axis by this amount, in radians.

zIsUp boolean <optional> true

Is the z axis up (true), or is y axis up (false)?

Returns:
Description:

This Mesh Game Object.

Since: 3.50.0