Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions examples/jsm/renderers/CSS3DRenderer.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
import {
Matrix4,
Object3D
Object3D,
Quaternion,
Vector3
} from '../../../build/three.module.js';

/**
* Based on http://www.emagix.net/academic/mscs-project/item/camera-sync-with-css3-and-webgl-threejs
*/

const _position = new Vector3();
const _quaternion = new Quaternion();
const _scale = new Vector3();

class CSS3DObject extends Object3D {

constructor( element ) {
Expand Down Expand Up @@ -245,8 +251,9 @@ class CSS3DRenderer {

if ( object.rotation2D !== 0 ) _matrix.multiply( _matrix2.makeRotationZ( object.rotation2D ) );

_matrix.copyPosition( object.matrixWorld );
_matrix.scale( object.scale );
object.matrixWorld.decompose( _position, _quaternion, _scale );
_matrix.setPosition( _position );
_matrix.scale( _scale );

_matrix.elements[ 3 ] = 0;
_matrix.elements[ 7 ] = 0;
Expand Down