public void setLocalRotation(Quat4f newQuat) { rotation.set(newQuat); }
public Bone(int index, String name, Vector3f position, Quat4f rotation) { this.index = index; this.name = name; this.objectSpacePos.set(position); this.rotation.set(rotation); }
private Quat4f[] quad4fArrayFromFloat16ArrayData(float[] inverseBindMatrixArray) { Quat4f[] rotationArray = new Quat4f[inverseBindMatrixArray.length / 16]; for (int i = 0; i < inverseBindMatrixArray.length / 16; ++i) { int offset = i * 16; Matrix4f matrix4f = new Matrix4f(Arrays.copyOfRange(inverseBindMatrixArray, offset, offset + 16)); Quat4f rotation = new Quat4f(); rotation.set(matrix4f); rotationArray[i] = rotation; } return rotationArray; }
@Override public org.terasology.math.geom.Quat4f getOrientation(org.terasology.math.geom.Quat4f out) { Quat4f vm = VecMath.to(out); rb.getOrientation(vm); out.set(vm.x, vm.y, vm.z, vm.w); return out; }
public CharacterStateEvent(CharacterStateEvent previous) { this.time = previous.time; this.position.set(previous.position); this.rotation.set(previous.rotation); this.mode = previous.mode; this.grounded = previous.grounded; this.velocity.set(previous.velocity); this.sequenceNumber = previous.sequenceNumber + 1; this.pitch = previous.pitch; this.yaw = previous.yaw; this.footstepDelta = previous.footstepDelta; this.climbDirection = previous.climbDirection; }
public Quat4f getWorldRotation(Quat4f output) { output.set(rotation); LocationComponent parentLoc = parent.getComponent(LocationComponent.class); while (parentLoc != null) { output.mul(parentLoc.rotation, output); parentLoc = parentLoc.parent.getComponent(LocationComponent.class); } return output; }
@SuppressWarnings(value = "SuspiciousNameCombination") private void updateRotation(CharacterMovementComponent movementComp, CharacterStateEvent result, CharacterMoveInputEvent input) { if (movementComp.faceMovementDirection && result.getVelocity().lengthSquared() > 0.01f) { float yaw = (float) Math.atan2(result.getVelocity().x, result.getVelocity().z); result.getRotation().set(new Vector3f(0, 1, 0), yaw); } else { result.getRotation().set(new Quat4f(TeraMath.DEG_TO_RAD * input.getYaw(), 0, 0)); } }
public void setWorldRotation(Quat4f value) { this.rotation.set(value); LocationComponent parentLoc = parent.getComponent(LocationComponent.class); if (parentLoc != null) { Quat4f worldRot = parentLoc.getWorldRotation(); worldRot.inverse(); this.rotation.mul(worldRot, this.rotation); } }
/** * A callback target for the controller listener. When this callback triggers, the pos of the mount point will * cuange to the value of the pose parameter. This is mainly designed as a callback, and not intended to be part * of the public interface of this class. * @param pose - the controller pose - a homogenous transformation matrix. * @param handIndex - the hand index - 0 for left and 1 for right. */ public void poseChanged(Matrix4f pose, int handIndex) { // do nothing for the second controller // TODO: put a hand for the second controller. if (handIndex != 0) { return; } trackingDataReceived = true; Matrix4f adjustedPose = pose.mul(toolAdjustmentMatrix); translate = new Vector3f(adjustedPose.m30(), adjustedPose.m31(), adjustedPose.m32()); org.joml.Vector4f jomlQuaternion = org.terasology.rendering.openvrprovider.OpenVRUtil.convertToQuaternion(adjustedPose); if (rotationQuaternion == null) { rotationQuaternion = new Quat4f(jomlQuaternion.x, jomlQuaternion.y, jomlQuaternion.z, jomlQuaternion.w); } else { rotationQuaternion.set(jomlQuaternion.x, jomlQuaternion.y, jomlQuaternion.z, jomlQuaternion.w); } } }
this.time = time; this.position.set(position); this.rotation.set(rotation); this.velocity.set(velocity); this.mode = mode;
location.getLocalRotation().set(new Vector3f(0, 1, 0), yaw); entity.saveComponent(location);