Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Object3D: add applyQuaternion() #11334

Merged
merged 2 commits into from
May 15, 2017
Merged
Show file tree
Hide file tree
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
5 changes: 4 additions & 1 deletion docs/api/core/Object3D.html
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,10 @@ <h3>[method:null add]( [page:Object3D object], ... )</h3>
</div>

<h3>[method:null applyMatrix]( [page:Matrix4 matrix] )</h3>
<div>This updates the position, rotation and scale with the matrix.</div>
<div>Applies the matrix transform to the object and updates the object's position, rotation and scale.</div>

<h3>[method:Object3D applyQuaternion]( [page:Quaternion quaternion] )</h3>
<div>Applies the rotation represented by the quaternion to the object.</div>

<h3>[method:Object3D clone]( [page:Boolean recursive] )</h3>
<div>
Expand Down
10 changes: 9 additions & 1 deletion src/core/Object3D.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,14 @@ Object.assign( Object3D.prototype, EventDispatcher.prototype, {

},

applyQuaternion: function ( q ) {

this.quaternion.premultiply( q );

return this;

},

setRotationFromAxisAngle: function ( axis, angle ) {

// assumes axis is normalized
Expand Down Expand Up @@ -272,7 +280,7 @@ Object.assign( Object3D.prototype, EventDispatcher.prototype, {

lookAt: function () {

// This routine does not support objects with rotated and/or translated parent(s)
// This method does not support objects with rotated and/or translated parent(s)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😁

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hehe. I'm younger than I used to be.


var m1 = new Matrix4();

Expand Down