src/controls.js
function rotateObject(obj, rotation, order) {
    let originRotation = obj.rotation.clone();
    obj.rotation.setFromVector3(originRotation.toVector3().add(rotation), order);

    if (obj.isCollided()) {
        obj.rotation.setFromVector3(originRotation.toVector3(), originRotation.order);
        return false;
    }

    obj.updateBoundingBox();
    events.triggerObjectChange(obj);

    return true;
}
function rotateObject(obj, rotation, order) {
    let originRotation = obj.rotation.clone();
    obj.rotation.setFromVector3(originRotation.toVector3().add(rotation), order);

    if (obj.isCollided()) {
        obj.rotation.setFromVector3(originRotation.toVector3(), originRotation.order);
        return false;
    }

    obj.updateBoundingBox();
    events.triggerObjectChange(obj);

    return true;
}
function rotateObject ( obj , rotation , order ) { let originRotation = obj . rotation . clone ( ) ; obj . rotation . setFromVector3 ( originRotation . toVector3 ( ) . add ( rotation ) , order ) ; if ( obj . isCollided ( ) ) { obj . rotation . setFromVector3 ( originRotation . toVector3 ( ) , originRotation . order ) ; return false ; } obj . updateBoundingBox ( ) ; events . triggerObjectChange ( obj ) ; return true ; }
Rotate an object with avoiiding collisions and triggering objectChangeEvent
@alias module:lib3d.rotateObject
@param {BaseObject} obj - Object to rotate
@param {THREE.Vector3} rotation - A vector with rotation angles in radians
@param {String} order - Euler angles order (optional)
Rotate an object with avoiiding collisions and triggering objectChangeEvent