本文整理了Java中com.jme3.math.Quaternion.set
方法的一些代码示例,展示了Quaternion.set
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Quaternion.set
方法的具体详情如下:
包路径:com.jme3.math.Quaternion
类名称:Quaternion
方法名:set
[英]sets the data in a Quaternion
object from the given list of parameters.
[中]从给定的参数列表中设置Quaternion
对象中的数据。
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
/**
* write the content of the wheelWorldRotation into the store
*
* @param store
*/
public void getWheelWorldRotation(final Quaternion store) {
store.set(this.wheelWorldRotation);
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
@Override
public Quaternion getOrientation(int index) {
tempq.set((float)-handState[index].rotation.data[1],
(float)handState[index].rotation.data[2],
(float)-handState[index].rotation.data[3],
(float)handState[index].rotation.data[0]);
return tempq;
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
/**
* Sets the rotation of the bone in object space.
* Warning: you need to call {@link #setUserControl(boolean)} with true to be able to do that operation
* @param rot
*/
public void setLocalRotation(Quaternion rot){
if (!userControl) {
throw new IllegalStateException("User control must be on bone to allow user transforms");
}
this.localRot.set(rot);
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
@Override
public void getPositionAndOrientation(Vector3f storePos, Quaternion storeRot) {
storePos.x = (float)-hmdPose.translation.data[0];
storePos.y = (float)hmdPose.translation.data[1];
storePos.z = (float)-hmdPose.translation.data[2];
storeRot.set((float)-hmdPose.rotation.data[1],
(float)hmdPose.rotation.data[2],
(float)-hmdPose.rotation.data[3],
(float)hmdPose.rotation.data[0]);
if( storeRot.equals(Quaternion.ZERO) ) storeRot.set(Quaternion.DIRECTION_Z);
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
@Override
public Quaternion getOrientation() {
storeRot.set((float)-hmdPose.rotation.data[1],
(float)hmdPose.rotation.data[2],
(float)-hmdPose.rotation.data[3],
(float)hmdPose.rotation.data[0]);
if( storeRot.equals(Quaternion.ZERO) ) storeRot.set(Quaternion.DIRECTION_Z);
return storeRot;
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
/**
* Stores this rotation value into the given Quaternion. If quat is null, a new Quaternion is created to
* hold the value. The value, once stored, is returned.
* @param quat The store location for this matrix's rotation.
* @return The value of this matrix's rotation.
*/
public Quaternion getRotation(Quaternion quat) {
if (quat==null) quat=new Quaternion();
quat.set(rot);
return quat;
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
/**
* <code>setAxes</code> uses a rotational matrix to set the axes of the
* camera.
*
* @param axes the matrix that defines the orientation of the camera.
*/
public void setAxes(Quaternion axes) {
this.rotation.set(axes);
onFrameChange();
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
@Override
protected Quaternion deserialize(int i, Quaternion store) {
int j = i * getTupleSize();
store.set(array[j], array[j + 1], array[j + 2], array[j + 3]);
return store;
}
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
@Override
public void getPositionAndOrientation(Vector3f storePos, Quaternion storeRot) {
hmdPose.toTranslationVector(storePos);
storePos.x = -storePos.x;
storePos.z = -storePos.z;
storeRot.set(getOrientation());
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
@Override
public void getPositionAndOrientation(Vector3f storePos, Quaternion storeRot) {
hmdPose.toTranslationVector(storePos);
storePos.x = -storePos.x;
storePos.z = -storePos.z;
storeRot.set(getOrientation());
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
void set(Quaternion rot) {
rotation.set(rot);
float[] a = new float[3];
rotation.toAngles(a);
eulerAngles.set(a[0], a[1], a[2]);
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
/**
* Loads the identity. Equal to translation=0,0,0 scale=1,1,1 rot=0,0,0,1.
*/
public void loadIdentity() {
translation.set(0, 0, 0);
scale.set(1, 1, 1);
rot.set(0, 0, 0, 1);
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
/**
* Sets this matrix to be equal to the given matrix.
* @param matrixQuat The matrix to be equal to.
* @return this
*/
public Transform set(Transform matrixQuat) {
this.translation.set(matrixQuat.translation);
this.rot.set(matrixQuat.rot);
this.scale.set(matrixQuat.scale);
return this;
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
/**
* Sets this transform to the interpolation between the first transform and the second by delta amount.
* @param t1 The beginning transform.
* @param t2 The ending transform.
* @param delta An amount between 0 and 1 representing how far to interpolate from t1 to t2.
*/
public void interpolateTransforms(Transform t1, Transform t2, float delta) {
t1.rot.nlerp(t2.rot, delta);
this.rot.set(t1.rot);
this.translation.interpolateLocal(t1.translation,t2.translation,delta);
this.scale.interpolateLocal(t1.scale,t2.scale,delta);
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
@Override
public Quaternion getFinalObserverRotation(int index) {
OSVRViewManager vrvm = (OSVRViewManager)environment.getVRViewManager();
if( vrvm == null || isInputDeviceTracking(index) == false ) return null;
Object obs = environment.getObserver();
if( obs instanceof Camera ) {
tempq.set(((Camera)obs).getRotation());
} else {
tempq.set(((Spatial)obs).getWorldRotation());
}
return tempq.multLocal(getOrientation(index));
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
public static void convertMatrix4toQuat(Matrix4f in, Quaternion out) {
// convert rotation matrix to quat
out.fromRotationMatrix(in.m00, in.m01, in.m02, in.m10, in.m11, in.m12, in.m20, in.m21, in.m22);
// flip the pitch
out.set(-out.getX(), out.getY(), -out.getZ(), out.getW());
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
@Override
public void read(JmeImporter e) throws IOException {
InputCapsule capsule = e.getCapsule(this);
rot.set((Quaternion)capsule.readSavable("rot", Quaternion.IDENTITY));
translation.set((Vector3f)capsule.readSavable("translation", Vector3f.ZERO));
scale.set((Vector3f)capsule.readSavable("scale", Vector3f.UNIT_XYZ));
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
/**
* @return the physicsLocation
*/
public Quaternion getPhysicsRotation(Quaternion rot) {
if (rot == null) {
rot = new Quaternion();
}
gObject.getWorldTransform(tempTrans);
Converter.convert(tempTrans.getRotation(tempRot), physicsLocation.getRotation());
return rot.set(physicsLocation.getRotation());
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
public void fromTransformMatrix(Matrix4f mat) {
TempVars vars = TempVars.get();
translation.set(mat.toTranslationVector(vars.vect1));
rot.set(mat.toRotationQuat(vars.quat1));
scale.set(mat.toScaleVector(vars.vect2));
vars.release();
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
private static Quaternion spline(Quaternion qnm1, Quaternion qn, Quaternion qnp1, Quaternion store, Quaternion tmp) {
Quaternion invQn = new Quaternion(-qn.x, -qn.y, -qn.z, qn.w);
log(invQn.mult(qnp1), tmp);
log(invQn.mult(qnm1), store);
store.addLocal(tmp).multLocal(-1f / 4f);
exp(store, tmp);
store.set(qn).multLocal(tmp);
return store.normalizeLocal();
//return qn * (((qni * qnm1).log() + (qni * qnp1).log()) / -4).exp();
}
内容来源于网络,如有侵权,请联系作者删除!