当前位置: 首页>>代码示例>>Java>>正文


Java Quaternion.multLocal方法代码示例

本文整理汇总了Java中com.jme3.math.Quaternion.multLocal方法的典型用法代码示例。如果您正苦于以下问题:Java Quaternion.multLocal方法的具体用法?Java Quaternion.multLocal怎么用?Java Quaternion.multLocal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.jme3.math.Quaternion的用法示例。


在下文中一共展示了Quaternion.multLocal方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: rotateUpTo

import com.jme3.math.Quaternion; //导入方法依赖的package包/类
/**
 * <code>rotateUpTo</code> is a utility function that alters the
 * local rotation to point the Y axis in the direction given by newUp.
 *
 * @param newUp
 *            the up vector to use - assumed to be a unit vector.
 */
public void rotateUpTo(Vector3f newUp) {
    TempVars vars = TempVars.get();

    Vector3f compVecA = vars.vect1;
    Quaternion q = vars.quat1;

    // First figure out the current up vector.
    Vector3f upY = compVecA.set(Vector3f.UNIT_Y);
    Quaternion rot = localTransform.getRotation();
    rot.multLocal(upY);

    // get angle between vectors
    float angle = upY.angleBetween(newUp);

    // figure out rotation axis by taking cross product
    Vector3f rotAxis = upY.crossLocal(newUp).normalizeLocal();

    // Build a rotation quat and apply current local rotation.
    q.fromAngleNormalAxis(angle, rotAxis);
    q.mult(rot, rot);

    vars.release();

    setTransformRefresh();
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:33,代码来源:Spatial.java

示例2: computeTargetDirection

import com.jme3.math.Quaternion; //导入方法依赖的package包/类
private void computeTargetDirection() {
    switch (directionType) {
        case Path:
            Quaternion q = new Quaternion();
            q.lookAt(direction, Vector3f.UNIT_Y);
            spatial.setLocalRotation(q);
            break;
        case LookAt:
            if (lookAt != null) {
                spatial.lookAt(lookAt, upVector);
            }
            break;
        case PathAndRotation:
            if (rotation != null) {
                Quaternion q2 = new Quaternion();
                q2.lookAt(direction, Vector3f.UNIT_Y);
                q2.multLocal(rotation);
                spatial.setLocalRotation(q2);
            }
            break;
        case Rotation:
            if (rotation != null) {
                spatial.setLocalRotation(rotation);
            }
            break;
        case None:
            break;
        default:
            break;
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:32,代码来源:MotionTrack.java

示例3: 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

示例4: doAnimUpdate

import com.jme3.math.Quaternion; //导入方法依赖的package包/类
@Override
protected void doAnimUpdate(float interpolation) {
    
    TempVars tv = TempVars.get();
    float distance = interpolation * spline.getTotalLength();
    
    // 1.获取spline上指定距离处的位置
    getSplinePoint(spline, distance, tv.vect1);
    
    if (interpolation >= 1) {
        // end
        target.setLocalTranslation(spline.getControlPoints().get(spline.getControlPoints().size() - 1));
    } else {
        // dir
        if (facePath) {
            tv.vect1.subtract(target.getLocalTranslation(), tv.vect2).normalizeLocal();
            Quaternion rot = target.getLocalRotation();
            rot.lookAt(tv.vect2, Vector3f.UNIT_Y);
            if (rotationOffset != null) {
                rot.multLocal(rotationOffset);
            }
            target.setLocalRotation(rot);
        }
        target.setLocalTranslation(tv.vect1);
    }
    tv.release();
}
 
开发者ID:huliqing,项目名称:LuoYing,代码行数:28,代码来源:CurveMoveAnim.java


注:本文中的com.jme3.math.Quaternion.multLocal方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。