本文整理匯總了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();
}
示例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;
}
}
示例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);
}
示例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();
}