Transform based on z value

This commit is contained in:
Richard Davey 2020-10-07 13:16:10 +01:00
parent 55d7b36217
commit f6a0a8d96b

View file

@ -116,7 +116,7 @@ var Mesh = new Class({
* @type {Phaser.GameObjects.MeshCamera} * @type {Phaser.GameObjects.MeshCamera}
* @since 3.50.0 * @since 3.50.0
*/ */
this.camera = new MeshCamera(45, 0, 0, -10, 0.001, 1000); this.camera = new MeshCamera(45, 0, 0, 0, 0.001, 1000);
/** /**
* The Animation State of this Mesh. * The Animation State of this Mesh.
@ -1145,11 +1145,13 @@ var Mesh = new Class({
normalMatrix.invert(); normalMatrix.invert();
normalMatrix.transpose(); normalMatrix.transpose();
var z = camera.position.z;
var vertices = this.vertices; var vertices = this.vertices;
for (var i = 0; i < vertices.length; i++) for (var i = 0; i < vertices.length; i++)
{ {
vertices[i].transformCoordinatesLocal(transformMatrix, width, height); vertices[i].transformCoordinatesLocal(transformMatrix, width, height, z);
} }
this.depthSort(); this.depthSort();