本文整理了Java中com.jme3.math.Quaternion.fromAngleNormalAxis
方法的一些代码示例,展示了Quaternion.fromAngleNormalAxis
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Quaternion.fromAngleNormalAxis
方法的具体详情如下:
包路径:com.jme3.math.Quaternion
类名称:Quaternion
方法名:fromAngleNormalAxis
[英]fromAngleNormalAxis
sets this quaternion to the values specified by an angle and a normalized axis of rotation.
[中]fromAngleNormalAxis
将此四元数设置为角度和标准化旋转轴指定的值。
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
/**
* <code>fromAngleAxis</code> sets this quaternion to the values specified
* by an angle and an axis of rotation. This method creates an object, so
* use fromAngleNormalAxis if your axis is already normalized.
*
* @param angle
* the angle to rotate (in radians).
* @param axis
* the axis of rotation.
* @return this quaternion
*/
public Quaternion fromAngleAxis(float angle, Vector3f axis) {
Vector3f normAxis = axis.normalize();
fromAngleNormalAxis(angle, normAxis);
return this;
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
private static Quaternion toQuat(float ax1v, Vector3f ax1, float ax2v, Vector3f ax2, float ax3v, Vector3f ax3) {
// TODO It has some potential in optimization
Quaternion q1 = new Quaternion().fromAngleNormalAxis(ax1v, ax1);
Quaternion q2 = new Quaternion().fromAngleNormalAxis(ax2v, ax2);
Quaternion q3 = new Quaternion().fromAngleNormalAxis(ax3v, ax3);
return q1.multLocal(q2).multLocal(q3);
}
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
/**
* rotate the camera around the target
*/
protected void rotateCamera() {
verticalRotation = FastMath.clamp(verticalRotation, minVerticalRotation, maxVerticalRotation);
TempVars vars = TempVars.get();
Quaternion rot = vars.quat1;
Quaternion rot2 = vars.quat2;
rot.fromAngleNormalAxis(verticalRotation, leftVector);
rot2.fromAngleNormalAxis(horizontalRotation, upVector);
rot2.multLocal(rot);
target.setLocalRotation(rot2);
vars.release();
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
rotation.fromAngleNormalAxis(angle, Vector3f.UNIT_Y);
floor.setLocalRotation(rotation);
sky.setLocalRotation(rotation);
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
rotation = new Quaternion();
axis.normalizeLocal();
rotation.fromAngleNormalAxis(angle, axis);
angle = 0;
axis = null;
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
TempVars vars = TempVars.get();
vars.vect1.set(faceNormal).normalizeLocal();
vars.quat1.fromAngleNormalAxis(p.angle, vars.vect1);
vars.quat1.multLocal(left);
vars.quat1.multLocal(up);
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
/**
* Forcefully takes over Camera adding functionality and placing it behind the character
* @param tpf Tickes Per Frame
*/
private void camTakeOver(float tpf) {
cam.setLocation(player.getLocalTranslation().add(-8, 2, 0));
cam.lookAt(player.getLocalTranslation(), Vector3f.UNIT_Y);
Quaternion rot = new Quaternion();
rot.fromAngleNormalAxis(camAngle, Vector3f.UNIT_Z);
cam.setRotation(cam.getRotation().mult(rot));
camAngle *= FastMath.pow(.99f, fpsRate * tpf);
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
/**
* <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();
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
motionControl.setRotation(new Quaternion().fromAngleNormalAxis(-FastMath.HALF_PI, Vector3f.UNIT_Y));
motionControl.setInitialDuration(10f);
motionControl.setSpeed(2f);
代码示例来源:origin: org.jmonkeyengine/jme3-core
/**
* <code>fromAngleAxis</code> sets this quaternion to the values specified
* by an angle and an axis of rotation. This method creates an object, so
* use fromAngleNormalAxis if your axis is already normalized.
*
* @param angle
* the angle to rotate (in radians).
* @param axis
* the axis of rotation.
* @return this quaternion
*/
public Quaternion fromAngleAxis(float angle, Vector3f axis) {
Vector3f normAxis = axis.normalize();
fromAngleNormalAxis(angle, normAxis);
return this;
}
代码示例来源:origin: info.projectkyoto/mms-engine
/**
* <code>fromAngleAxis</code> sets this quaternion to the values specified
* by an angle and an axis of rotation. This method creates an object, so
* use fromAngleNormalAxis if your axis is already normalized.
*
* @param angle
* the angle to rotate (in radians).
* @param axis
* the axis of rotation.
* @return this quaternion
*/
public Quaternion fromAngleAxis(float angle, Vector3f axis) {
Vector3f normAxis = axis.normalize();
fromAngleNormalAxis(angle, normAxis);
return this;
}
代码示例来源:origin: org.jmonkeyengine/jme3-plugins
private static Quaternion toQuat(float ax1v, Vector3f ax1, float ax2v, Vector3f ax2, float ax3v, Vector3f ax3) {
// TODO It has some potential in optimization
Quaternion q1 = new Quaternion().fromAngleNormalAxis(ax1v, ax1);
Quaternion q2 = new Quaternion().fromAngleNormalAxis(ax2v, ax2);
Quaternion q3 = new Quaternion().fromAngleNormalAxis(ax3v, ax3);
return q1.multLocal(q2).multLocal(q3);
}
}
代码示例来源:origin: org.jmonkeyengine/jme3-core
/**
* rotate the camera around the target
*/
protected void rotateCamera() {
verticalRotation = FastMath.clamp(verticalRotation, minVerticalRotation, maxVerticalRotation);
TempVars vars = TempVars.get();
Quaternion rot = vars.quat1;
Quaternion rot2 = vars.quat2;
rot.fromAngleNormalAxis(verticalRotation, leftVector);
rot2.fromAngleNormalAxis(horizontalRotation, upVector);
rot2.multLocal(rot);
target.setLocalRotation(rot2);
vars.release();
}
代码示例来源:origin: net.sf.phat/phat-audio
motionControl.setRotation(new Quaternion().fromAngleNormalAxis(-FastMath.HALF_PI, Vector3f.UNIT_Y));
motionControl.setInitialDuration(20f);
motionControl.setSpeed(0.1f);
代码示例来源:origin: net.sf.phat/phat-audio
motionControl.setRotation(new Quaternion().fromAngleNormalAxis(-FastMath.HALF_PI, Vector3f.UNIT_Y));
motionControl.setInitialDuration(20f);
motionControl.setSpeed(0.1f);
代码示例来源:origin: info.projectkyoto/mms-engine
/**
* Forcefully takes over Camera adding functionality and placing it behind the character
* @param tpf Tickes Per Frame
*/
private void camTakeOver(float tpf) {
cam.setLocation(player.getLocalTranslation().add(-8, 2, 0));
cam.lookAt(player.getLocalTranslation(), Vector3f.UNIT_Y);
Quaternion rot = new Quaternion();
rot.fromAngleNormalAxis(camAngle, Vector3f.UNIT_Z);
cam.setRotation(cam.getRotation().mult(rot));
camAngle *= FastMath.pow(.99f, fpsRate * tpf);
}
代码示例来源:origin: net.sf.phat/phat-audio
(MotionTrack.Direction.PathAndRotation);
motionControl.setRotation
(new Quaternion().fromAngleNormalAxis
(-FastMath.HALF_PI, Vector3f.UNIT_Y));
motionControl.setInitialDuration(20f);
代码示例来源:origin: org.jmonkeyengine/jme3-core
/**
* <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();
}
代码示例来源:origin: info.projectkyoto/mms-engine
/**
* <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();
}
代码示例来源:origin: info.projectkyoto/mms-engine
q = q.fromAngleNormalAxis((float) Math.PI / 8, new Vector3f(0, 0, 1));
node.skeleton = skeleton;
temp.release();
内容来源于网络,如有侵权,请联系作者删除!