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


Java Quaternion.normalizeLocal方法代碼示例

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


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

示例1: matchPhysicObjectToBone

import com.jme3.math.Quaternion; //導入方法依賴的package包/類
/**
 * Set the transforms of a rigidBody to match the transforms of a bone.
 * this is used to make the ragdoll follow the skeleton motion while in Kinematic mode
 * @param link the link containing the bone and the rigidBody
 * @param position just a temp vector for position
 * @param tmpRot1  just a temp quaternion for rotation
 */
private void matchPhysicObjectToBone(PhysicsBoneLink link, Vector3f position, Quaternion tmpRot1) {
    //computing position from rotation and scale
    targetModel.getWorldTransform().transformVector(link.bone.getModelSpacePosition(), position);

    //computing rotation
    tmpRot1.set(link.bone.getModelSpaceRotation()).multLocal(link.bone.getWorldBindInverseRotation());
    targetModel.getWorldRotation().mult(tmpRot1, tmpRot1);
    tmpRot1.normalizeLocal();

    //updating physic location/rotation of the physic bone
    link.rigidBody.setPhysicsLocation(position);
    link.rigidBody.setPhysicsRotation(tmpRot1);

}
 
開發者ID:mleoking,項目名稱:PhET,代碼行數:22,代碼來源:KinematicRagdollControl.java

示例2: blendToKinematicMode

import com.jme3.math.Quaternion; //導入方法依賴的package包/類
/**
 * Smoothly blend from Ragdoll mode to Kinematic mode
 * This is useful to blend ragdoll actual position to a keyframe animation for example
 * @param blendTime the blending time between ragdoll to anim.
 */
public void blendToKinematicMode(float blendTime) {
    if (mode == Mode.Kinetmatic) {
        return;
    }
    blendedControl = true;
    this.blendTime = blendTime;
    mode = Mode.Kinetmatic;
    AnimControl animControl = targetModel.getControl(AnimControl.class);
    animControl.setEnabled(true);


    TempVars vars = TempVars.get();        
    for (PhysicsBoneLink link : boneLinks.values()) {

        Vector3f p = link.rigidBody.getMotionState().getWorldLocation();
        Vector3f position = vars.vect1;

        targetModel.getWorldTransform().transformInverseVector(p, position);

        Quaternion q = link.rigidBody.getMotionState().getWorldRotationQuat();
        Quaternion q2 = vars.quat1;
        Quaternion q3 = vars.quat2;

        q2.set(q).multLocal(link.initalWorldRotation).normalizeLocal();
        q3.set(targetModel.getWorldRotation()).inverseLocal().mult(q2, q2);
        q2.normalizeLocal();
        link.startBlendingPos.set(position);
        link.startBlendingRot.set(q2);
        link.rigidBody.setKinematic(true);
    }
    vars.release();

    for (Bone bone : skeleton.getRoots()) {
        RagdollUtils.setUserControl(bone, false);
    }

    blendStart = 0;
}
 
開發者ID:mleoking,項目名稱:PhET,代碼行數:44,代碼來源:KinematicRagdollControl.java


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