Skip to content

How can I use quaternions? #9

@cx20

Description

@cx20

Below is an example of using quaternion in Three.js.
http://jsdo.it/cx20/qqSi

    // rotate
    mesh1.rotation.x += Math.PI / 180;
    mesh1.rotation.y += Math.PI / 180;
    mesh1.rotation.z += Math.PI / 180;
    
    // quaternion
    var axis = new THREE.Vector3(1,1,1).normalize();
    angle += Math.PI / 180;
    var q = new THREE.Quaternion();
    q.setFromAxisAngle(axis,angle);
    mesh2.quaternion.copy(q);

How do I write the code in CZPG.js to do the same thing as above?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions