當前位置: 首頁>>代碼示例>>Java>>正文


Java Quaternion.set方法代碼示例

本文整理匯總了Java中com.jme3.math.Quaternion.set方法的典型用法代碼示例。如果您正苦於以下問題:Java Quaternion.set方法的具體用法?Java Quaternion.set怎麽用?Java Quaternion.set使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.jme3.math.Quaternion的用法示例。


在下文中一共展示了Quaternion.set方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setBindingPose

import com.jme3.math.Quaternion; //導入方法依賴的package包/類
/**
 * Saves the current bone state as its binding pose, including its children.
 */
void setBindingPose() {
    initialPos.set(localPos);
    initialRot.set(localRot);
    initialScale.set(localScale);

    if (worldBindInversePos == null) {
        worldBindInversePos = new Vector3f();
        worldBindInverseRot = new Quaternion();
        worldBindInverseScale = new Vector3f();
    }

    // Save inverse derived position/scale/orientation, used for calculate offset transform later
    worldBindInversePos.set(worldPos);
    worldBindInversePos.negateLocal();

    worldBindInverseRot.set(worldRot);
    worldBindInverseRot.inverseLocal();

    worldBindInverseScale.set(Vector3f.UNIT_XYZ);
    worldBindInverseScale.divideLocal(worldScale);

    for (Bone b : children) {
        b.setBindingPose();
    }
}
 
開發者ID:mleoking,項目名稱:PhET,代碼行數:29,代碼來源:Bone.java

示例2: applyWheelTransform

import com.jme3.math.Quaternion; //導入方法依賴的package包/類
public synchronized void applyWheelTransform() {
    if (wheelSpatial == null) {
        return;
    }
    Quaternion localRotationQuat = wheelSpatial.getLocalRotation();
    Vector3f localLocation = wheelSpatial.getLocalTranslation();
    if (!applyLocal && wheelSpatial.getParent() != null) {
        localLocation.set(wheelWorldLocation).subtractLocal(wheelSpatial.getParent().getWorldTranslation());
        localLocation.divideLocal(wheelSpatial.getParent().getWorldScale());
        tmp_inverseWorldRotation.set(wheelSpatial.getParent().getWorldRotation()).inverseLocal().multLocal(localLocation);

        localRotationQuat.set(wheelWorldRotation);
        tmp_inverseWorldRotation.set(wheelSpatial.getParent().getWorldRotation()).inverseLocal().mult(localRotationQuat, localRotationQuat);

        wheelSpatial.setLocalTranslation(localLocation);
        wheelSpatial.setLocalRotation(localRotationQuat);
    } else {
        wheelSpatial.setLocalTranslation(wheelWorldLocation);
        wheelSpatial.setLocalRotation(wheelWorldRotation);
    }
}
 
開發者ID:mleoking,項目名稱:PhET,代碼行數:22,代碼來源:VehicleWheel.java

示例3: getComputeTransform

import com.jme3.math.Quaternion; //導入方法依賴的package包/類
/**
 * 計算出相機的跟隨位置,但是不立即改變相機的位置。
 * @param locStore
 * @param rotationStore 
 */
public void getComputeTransform(Vector3f locStore, Quaternion rotationStore) {
    TempVars tv = TempVars.get();
    Vector3f originLoc = tv.vect1.set(cam.getLocation());
    Quaternion originRot = tv.quat1.set(cam.getRotation());
    
    boolean originEnabled = isEnabled();
    setEnabled(true);
    update(0.016f);
    setEnabled(originEnabled);
    
    locStore.set(cam.getLocation());
    rotationStore.set(cam.getRotation());
    
    cam.setLocation(originLoc);
    cam.setRotation(originRot);
    tv.release();
}
 
開發者ID:huliqing,項目名稱:LuoYing,代碼行數:23,代碼來源:CollisionChaseCamera.java

示例4: applyPhysicsTransform

import com.jme3.math.Quaternion; //導入方法依賴的package包/類
protected void applyPhysicsTransform(@NotNull final Vector3f worldLocation, @NotNull final Quaternion worldRotation,
                                     @Nullable final Spatial spatial) {
    if (spatial == null) return;

    final Vector3f localLocation = spatial.getLocalTranslation();
    final Quaternion localRotation = spatial.getLocalRotation();

    final Node parent = spatial.getParent();

    if (parent == null) {
        spatial.setLocalTranslation(worldLocation);
        spatial.setLocalRotation(worldRotation);
    } else {

        localLocation.set(worldLocation)
                     .subtractLocal(parent.getWorldTranslation());

        localLocation.divideLocal(parent.getWorldScale());

        inverseWorldRotation.set(parent.getWorldRotation())
                            .inverseLocal()
                            .multLocal(localLocation);

        localRotation.set(worldRotation);

        inverseWorldRotation.set(parent.getWorldRotation())
                            .inverseLocal()
                            .mult(localRotation, localRotation);

        spatial.setLocalTranslation(localLocation);
        spatial.setLocalRotation(localRotation);
    }
}
 
開發者ID:JavaSaBr,項目名稱:jmonkeybuilder-extension,代碼行數:34,代碼來源:AbstractPhysicsDebugControl.java

示例5: parseInto

import com.jme3.math.Quaternion; //導入方法依賴的package包/類
private void parseInto(String text, Quaternion res) throws IllegalArgumentException {
    text = text.replace('[', ' ');
    text = text.replace(']', ' ').trim();
    String[] a = text.split("\\s*(,|\\s)\\s*");


    if (a.length == 1) {
        if (text.trim().toLowerCase().equals("nan")) {
            res.set(Float.NaN, Float.NaN, Float.NaN, Float.NaN);
            return;
        }
        float f = Float.parseFloat(text);
        f = (float) Math.toRadians(f);
        res.fromAngles(f, f, f);
        return;
    }

    if (a.length == 3) {
        float[] floats = new float[3];
        for (int i = 0; i < a.length; i++) {
            floats[i] = (float) Math.toRadians(Float.parseFloat(a[i]));
        }
        res.fromAngles(floats);
        return;
    }
    throw new IllegalArgumentException("String not correct");
}
 
開發者ID:jMonkeyEngine,項目名稱:sdk,代碼行數:28,代碼來源:QuaternionPropertyEditor.java

示例6: rotate

import com.jme3.math.Quaternion; //導入方法依賴的package包/類
public float rotate(Quaternion rot, float deltaRangePrecision) {
    if (state != HandState.Grasped) {
        throw new IllegalStateException("illegal operation");
    }
    if (rot == null) {
        throw new NullPointerException();
    }
    graspNodeTarget.set(graspNode.getLocalTransform());
    graspNodeTarget.setRotation(rot);
    float delta = tryTransformingGraspNode(graspNode, graspNodeTarget, deltaRangePrecision);
    if (delta < 1) {
        rot.set(graspNode.getLocalRotation());
    }
    return delta;
}
 
開發者ID:dwhuang,項目名稱:SMILE,代碼行數:16,代碼來源:Demonstrator.java

示例7: doUpdateTraceRotation

import com.jme3.math.Quaternion; //導入方法依賴的package包/類
private void doUpdateTraceRotation() {
    Quaternion rot = getLocalRotation();
    rot.set(traceObject.getWorldRotation());
    if (traceRotationOffset != null) {
        rot.multLocal(traceRotationOffset);
    }
    setLocalRotation(rot);
}
 
開發者ID:huliqing,項目名稱:LuoYing,代碼行數:9,代碼來源:TraceEffect.java

示例8: deserialize

import com.jme3.math.Quaternion; //導入方法依賴的package包/類
@Override
protected Quaternion deserialize(int i, Quaternion store) {
    int j = i * getTupleSize();
    store.set(array[j], array[j + 1], array[j + 2], array[j + 3]);
    return store;
}
 
開發者ID:mleoking,項目名稱:PhET,代碼行數:7,代碼來源:CompactQuaternionArray.java

示例9: setAsText

import com.jme3.math.Quaternion; //導入方法依賴的package包/類
public void setAsText(String text) throws IllegalArgumentException {
    Quaternion old = new Quaternion();
    old.set(quaternion);
    parseInto(text, quaternion);
    notifyListeners(old, quaternion);
}
 
開發者ID:jMonkeyEngine,項目名稱:sdk,代碼行數:7,代碼來源:QuaternionPropertyEditor.java


注:本文中的com.jme3.math.Quaternion.set方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。