Java Code Examples for com.badlogic.gdx.math.Quaternion#set()

The following examples show how to use com.badlogic.gdx.math.Quaternion#set() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TypeTransformer.java    From gdx-vr with Apache License 2.0 5 votes vote down vote up
public static void transform(OvrQuaternionf sourceQuaternion, Quaternion quaternion) {
	float x = sourceQuaternion.x;
	float y = sourceQuaternion.y;
	float z = sourceQuaternion.z;
	float w = sourceQuaternion.w;

	quaternion.set(x, y, z, w);
}
 
Example 2
Source File: VirtualRealityRenderer.java    From gdx-vr with Apache License 2.0 5 votes vote down vote up
private void renderEye(Viewport eye, Vector3 eyeOffset) {
	Camera camera = eye.getCamera();

	Vector3 eyePosition = camera.position;
	eyePosition.set(VirtualReality.body.position);

	Vector3 headOffset = new Vector3(0, VirtualReality.head.getEyeHeight() / 2f, 0);
	headOffset.mul(VirtualReality.body.orientation);
	eyePosition.add(headOffset);

	Quaternion eyeOrientation = new Quaternion();
	eyeOrientation.set(VirtualReality.head.getOrientation());
	eyeOrientation.mul(VirtualReality.body.orientation);

	eyeOffset.mul(eyeOrientation);
	eyePosition.add(eyeOffset);

	Vector3 eyeDirection = new Vector3(0, 0, -1);
	eyeDirection.mul(eyeOrientation);
	Vector3 eyeUp = new Vector3(0, 1, 0);
	eyeUp.mul(eyeOrientation);

	camera.position.set(eyePosition);
	camera.direction.set(eyeDirection);
	camera.up.set(eyeUp);

	camera.update(true);

	for (VirtualRealityRenderListener listener : listeners) {
		listener.render(camera);
	}
}
 
Example 3
Source File: GLTFTypes.java    From gdx-gltf with Apache License 2.0 4 votes vote down vote up
public static Quaternion map(Quaternion q, float[] fv) {
	return q.set(fv[0], fv[1], fv[2], fv[3]);
}
 
Example 4
Source File: GLTFTypes.java    From gdx-gltf with Apache License 2.0 4 votes vote down vote up
public static Quaternion map(Quaternion q, float[] fv, int offset) {
	return q.set(fv[offset+0], fv[offset+1], fv[offset+2], fv[offset+3]);
}
 
Example 5
Source File: SimpleNode.java    From Mundus with Apache License 2.0 4 votes vote down vote up
@Override
public Quaternion getLocalRotation(Quaternion out) {
    return out.set(localRotation);
}