phaser - v3.90.0
    Preparing search index...

    Function GenerateObjVerts

    • This method will return an object containing Face and Vertex instances, generated from the parsed triangulated OBJ Model data given to this function.

      The obj data should have been parsed in advance via the ParseObj function:

      var data = Phaser.Geom.Mesh.ParseObj(rawData, flipUV);

      var results = GenerateObjVerts(data);

      Alternatively, you can parse obj files loaded via the OBJFile loader:

      preload ()
      {
      this.load.obj('alien', 'assets/3d/alien.obj);
      }

      var results = GenerateObjVerts(this.cache.obj.get('alien));

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

      You can use the data returned by this function to populate the vertices of a Mesh Game Object.

      You may 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 large) to visualize. You can also offset the model via the x, y and z parameters.

      Parameters

      • data: OBJData

        The parsed OBJ model data.

      • Optionalmesh: GameObjects.Mesh

        An optional Mesh Game Object. If given, the generated Faces will be automatically added to this Mesh. Set to null to skip.

      • Optionalscale: number

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

      • Optionalx: number

        Translate the model x position by this amount. Default 0.

      • Optionaly: number

        Translate the model y position by this amount. Default 0.

      • Optionalz: number

        Translate the model z position by this amount. Default 0.

      • OptionalrotateX: number

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

      • OptionalrotateY: number

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

      • OptionalrotateZ: number

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

      • OptionalzIsUp: boolean

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

      Returns GenerateVertsResult