|
@@ -45,9 +45,14 @@ Sprite.prototype = Object.assign( Object.create( Object3D.prototype ), {
|
|
|
alignedPosition.set( ( 0.5 - this.center.x ) * worldScale.x, ( 0.5 - this.center.y ) * worldScale.y );
|
|
|
|
|
|
var rotation = this.material.rotation;
|
|
|
- rotatedPosition.x = ( Math.cos( rotation ) * alignedPosition.x ) - ( Math.sin( rotation ) * alignedPosition.y );
|
|
|
- rotatedPosition.y = ( Math.sin( rotation ) * alignedPosition.x ) + ( Math.cos( rotation ) * alignedPosition.y );
|
|
|
-
|
|
|
+ if ( rotation !== 0 ) {
|
|
|
+ var cos = Math.cos( rotation ), sin = Math.sin( rotation );
|
|
|
+ rotatedPosition.x = ( cos * alignedPosition.x ) - ( sin * alignedPosition.y );
|
|
|
+ rotatedPosition.y = ( sin * alignedPosition.x ) + ( cos * alignedPosition.y );
|
|
|
+ } else {
|
|
|
+ rotatedPosition.copy( alignedPosition );
|
|
|
+ }
|
|
|
+
|
|
|
worldPosition.setFromMatrixPosition( this.modelViewMatrix );
|
|
|
worldPosition.x += rotatedPosition.x;
|
|
|
worldPosition.y += rotatedPosition.y;
|