We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8ff78ef commit c6d25c9Copy full SHA for c6d25c9
1 file changed
src/geom/mesh/Face.js
@@ -312,15 +312,19 @@ var Face = new Class({
312
* @method Phaser.Geom.Mesh.Face#isCounterClockwise
313
* @since 3.50.0
314
*
315
+ * @param {number} z - The z-axis value to test against. Typically the `MeshCamera.position.z`.
316
+ *
317
* @return {boolean} `true` if the vertices in this Face run counter-clockwise, otherwise `false`.
318
*/
- isCounterClockwise: function ()
319
+ isCounterClockwise: function (z)
320
{
321
var v1 = this.vertex1;
322
var v2 = this.vertex2;
323
var v3 = this.vertex3;
324
- return (v2.vx - v1.vx) * (v3.vy - v1.vy) - (v2.vy - v1.vy) * (v3.vx - v1.vx) >= 0;
325
+ var d = (v2.vx - v1.vx) * (v3.vy - v1.vy) - (v2.vy - v1.vy) * (v3.vx - v1.vx);
326
+
327
+ return (z <= 0) ? d >= 0 : d < 0;
328
},
329
330
/**
0 commit comments