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


Java Quaternion.getRotationColumn方法代碼示例

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


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

示例1: updateCamera

import com.jme3.math.Quaternion; //導入方法依賴的package包/類
public void updateCamera() {
    rootNode.updateGeometricState();

    Vector3f pos = spaceCraft.getWorldTranslation().clone();
    Quaternion rot = spaceCraft.getWorldRotation();
    Vector3f dir = rot.getRotationColumn(2);

    // make it XZ only
    Vector3f camPos = new Vector3f(dir);
    camPos.setY(0);
    camPos.normalizeLocal();

    // negate and multiply by distance from object
    camPos.negateLocal();
    camPos.multLocal(15);

    // add Y distance
    camPos.setY(2);
    camPos.addLocal(pos);
    cam.setLocation(camPos);

    Vector3f lookAt = new Vector3f(dir);
    lookAt.multLocal(7); // look at dist
    lookAt.addLocal(pos);
    cam.lookAt(lookAt, Vector3f.UNIT_Y);
}
 
開發者ID:mleoking,項目名稱:PhET,代碼行數:27,代碼來源:TestHoveringTank.java

示例2: makeMissile

import com.jme3.math.Quaternion; //導入方法依賴的package包/類
public void makeMissile() {
    Vector3f pos = spaceCraft.getWorldTranslation().clone();
    Quaternion rot = spaceCraft.getWorldRotation();
    Vector3f dir = rot.getRotationColumn(2);

    Spatial missile = assetManager.loadModel("Models/SpaceCraft/Rocket.mesh.xml");
    missile.scale(0.5f);
    missile.rotate(0, FastMath.PI, 0);
    missile.updateGeometricState();

    BoundingBox box = (BoundingBox) missile.getWorldBound();
    final Vector3f extent = box.getExtent(null);

    BoxCollisionShape boxShape = new BoxCollisionShape(extent);

    missile.setName("Missile");
    missile.rotate(rot);
    missile.setLocalTranslation(pos.addLocal(0, extent.y * 4.5f, 0));
    missile.setLocalRotation(hoverControl.getPhysicsRotation());
    missile.setShadowMode(ShadowMode.Cast);
    RigidBodyControl control = new BombControl(assetManager, boxShape, 20);
    control.setLinearVelocity(dir.mult(100));
    control.setCollisionGroup(PhysicsCollisionObject.COLLISION_GROUP_03);
    missile.addControl(control);


    rootNode.attachChild(missile);
    getPhysicsSpace().add(missile);
}
 
開發者ID:mleoking,項目名稱:PhET,代碼行數:30,代碼來源:TestHoveringTank.java

示例3: getUp

import com.jme3.math.Quaternion; //導入方法依賴的package包/類
/**
 * Get the UP vector from the rotation.
 *
 * @param rotation the rotation
 * @param store    the store
 * @return the up
 */
@NotNull
public static Vector3f getUp(@NotNull final Quaternion rotation, @NotNull final Vector3f store) {
    return rotation.getRotationColumn(1, store);
}
 
開發者ID:JavaSaBr,項目名稱:jmonkeybuilder,代碼行數:12,代碼來源:GeomUtils.java

示例4: getLeft

import com.jme3.math.Quaternion; //導入方法依賴的package包/類
/**
 * Get the Left vector from the rotation.
 *
 * @param rotation the rotation
 * @param store    the store
 * @return the left
 */
@NotNull
public static Vector3f getLeft(@NotNull final Quaternion rotation, @NotNull final Vector3f store) {
    return rotation.getRotationColumn(0, store);
}
 
開發者ID:JavaSaBr,項目名稱:jmonkeybuilder,代碼行數:12,代碼來源:GeomUtils.java

示例5: getDirection

import com.jme3.math.Quaternion; //導入方法依賴的package包/類
/**
 * Get the Direction vector from the rotation.
 *
 * @param rotation the rotation
 * @param store    the store
 * @return the direction
 */
@NotNull
public static Vector3f getDirection(@NotNull final Quaternion rotation, @NotNull final Vector3f store) {
    return rotation.getRotationColumn(2, store);
}
 
開發者ID:JavaSaBr,項目名稱:jmonkeybuilder,代碼行數:12,代碼來源:GeomUtils.java


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