Java Code Examples for com.jme3.math.Quaternion#clone()

The following examples show how to use com.jme3.math.Quaternion#clone() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CameraTweens.java    From Lemur with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public RotateCamera( Camera target, Quaternion from, Quaternion to, double length ) {
    super(length);
    this.target = target;
    this.from = from.clone();
    this.to = to.clone();
    this.value = from.clone();
}
 
Example 2
Source File: SpatialTweens.java    From Lemur with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public RotateSpatial( Spatial target, Quaternion from, Quaternion to, double length ) {
    super(length);
    this.target = target;
    this.from = from.clone();
    this.to = to.clone();
    this.value = from.clone();
}
 
Example 3
Source File: ConstraintDefinitionRotLike.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public void bake(Transform ownerTransform, Transform targetTransform, float influence) {
    Quaternion ownerRotation = ownerTransform.getRotation();
    ownerAngles = ownerRotation.toAngles(ownerAngles);
    targetAngles = targetTransform.getRotation().toAngles(targetAngles);

    Quaternion startRotation = ownerRotation.clone();
    Quaternion offset = Quaternion.IDENTITY;
    if ((flag & ROTLIKE_OFFSET) != 0) {// we add the original rotation to
                                       // the copied rotation
        offset = startRotation;
    }

    if ((flag & ROTLIKE_X) != 0) {
        ownerAngles[0] = targetAngles[0];
        if ((flag & ROTLIKE_X_INVERT) != 0) {
            ownerAngles[0] = -ownerAngles[0];
        }
    }
    if ((flag & ROTLIKE_Y) != 0) {
        ownerAngles[1] = targetAngles[1];
        if ((flag & ROTLIKE_Y_INVERT) != 0) {
            ownerAngles[1] = -ownerAngles[1];
        }
    }
    if ((flag & ROTLIKE_Z) != 0) {
        ownerAngles[2] = targetAngles[2];
        if ((flag & ROTLIKE_Z_INVERT) != 0) {
            ownerAngles[2] = -ownerAngles[2];
        }
    }
    ownerRotation.fromAngles(ownerAngles).multLocal(offset);

    if (influence < 1.0f) {
        // startLocation.subtractLocal(ownerLocation).normalizeLocal().mult(influence);
        // ownerLocation.addLocal(startLocation);
        // TODO
    }
}
 
Example 4
Source File: QuaternionPropertyControl.java    From jmonkeybuilder with Apache License 2.0 4 votes vote down vote up
@Override
@FxThread
protected void setPropertyValue(@Nullable Quaternion quaternion) {
    super.setPropertyValue(quaternion == null ? null : quaternion.clone());
}