public static javax.vecmath.Quat4f to(Quat4f v) { return new javax.vecmath.Quat4f(v.x, v.y, v.z, v.w); }
public static javax.vecmath.Quat4f convert(com.jme3.math.Quaternion oldQuat) { javax.vecmath.Quat4f newQuat = new javax.vecmath.Quat4f(); convert(oldQuat, newQuat); return newQuat; }
@Override public BulletSweepCallback sweep(org.terasology.math.geom.Vector3f startPos, org.terasology.math.geom.Vector3f endPos, float allowedPenetration, float slopeFactor) { Transform startTransform = new Transform(new Matrix4f(new Quat4f(0, 0, 0, 1), VecMath.to(startPos), 1.0f)); Transform endTransform = new Transform(new Matrix4f(new Quat4f(0, 0, 0, 1), VecMath.to(endPos), 1.0f)); BulletSweepCallback callback = new BulletSweepCallback(collider, new org.terasology.math.geom.Vector3f(0, 1, 0), slopeFactor); callback.collisionFilterGroup = collider.getBroadphaseHandle().collisionFilterGroup; callback.collisionFilterMask = collider.getBroadphaseHandle().collisionFilterMask; callback.collisionFilterMask = (short) (callback.collisionFilterMask & (~StandardCollisionGroup.SENSOR.getFlag())); collider.convexSweepTest((ConvexShape) (collider.getCollisionShape()), startTransform, endTransform, callback, allowedPenetration); return callback; } }
private PairCachingGhostObject createCollider(Vector3f pos, ConvexShape shape, short groups, short filters, int collisionFlags) { Transform startTransform = new Transform(new Matrix4f(new Quat4f(0, 0, 0, 1), pos, 1.0f)); PairCachingGhostObject result = new PairCachingGhostObject(); result.setWorldTransform(startTransform); result.setCollisionShape(shape); result.setCollisionFlags(collisionFlags); discreteDynamicsWorld.addCollisionObject(result, groups, filters); return result; }
toWorld.y -= 0.2f; CollisionWorld.ClosestRayResultCallback rayResult = new CollisionWorld.ClosestRayResultCallback(fromWorld, toWorld); Transform from = new Transform(new Matrix4f(new Quat4f(0, 0, 0, 1), fromWorld, 1.0f)); Transform to = new Transform(new Matrix4f(new Quat4f(0, 0, 0, 1), toWorld, 1.0f)); Transform targetTransform = this.hitCollisionObject.getWorldTransform(new Transform()); CollisionWorld.rayTestSingle(from, to, this.hitCollisionObject, this.hitCollisionObject.getCollisionShape(), targetTransform, rayResult); toWorld.add(secondTraceOffset); rayResult = new CollisionWorld.ClosestRayResultCallback(fromWorld, toWorld); from = new Transform(new Matrix4f(new Quat4f(0, 0, 0, 1), fromWorld, 1.0f)); to = new Transform(new Matrix4f(new Quat4f(0, 0, 0, 1), toWorld, 1.0f)); targetTransform = this.hitCollisionObject.getWorldTransform(new Transform()); CollisionWorld.rayTestSingle(from, to, this.hitCollisionObject, this.hitCollisionObject.getCollisionShape(), targetTransform, rayResult);
toWorld.add(lookAheadOffset); CollisionWorld.ClosestRayResultCallback rayResult = new CollisionWorld.ClosestRayResultCallback(fromWorld, toWorld); Transform transformFrom = new Transform(new Matrix4f(new Quat4f(0, 0, 0, 1), fromWorld, 1.0f)); Transform transformTo = new Transform(new Matrix4f(new Quat4f(0, 0, 0, 1), toWorld, 1.0f)); Transform targetTransform = this.hitCollisionObject.getWorldTransform(new Transform()); CollisionWorld.rayTestSingle(transformFrom, transformTo, this.hitCollisionObject, this.hitCollisionObject.getCollisionShape(), targetTransform, rayResult); toWorld.add(lookAheadOffset); rayResult = new CollisionWorld.ClosestRayResultCallback(fromWorld, toWorld); transformFrom = new Transform(new Matrix4f(new Quat4f(0, 0, 0, 1), fromWorld, 1.0f)); transformTo = new Transform(new Matrix4f(new Quat4f(0, 0, 0, 1), toWorld, 1.0f)); targetTransform = this.hitCollisionObject.getWorldTransform(new Transform()); CollisionWorld.rayTestSingle(transformFrom, transformTo, this.hitCollisionObject, this.hitCollisionObject.getCollisionShape(), targetTransform, rayResult);
@Override public void setWorldTransform(Transform transform) { LocationComponent loc = entity.getComponent(LocationComponent.class); if (loc != null) { loc.setWorldPosition(VecMath.from(transform.origin)); loc.setWorldRotation(VecMath.from(transform.getRotation(new javax.vecmath.Quat4f()))); } }
@Override public Quat4f initialValue() { return new Quat4f(); } };
public void setLidarOrientation(Quat4d lidarOrientation) { this.lidarOrientation = new Quat4f(lidarOrientation); }
public static javax.vecmath.Quat4f convert(com.jme3.math.Quaternion oldQuat) { javax.vecmath.Quat4f newQuat = new javax.vecmath.Quat4f(); convert(oldQuat, newQuat); return newQuat; }
public static javax.vecmath.Quat4f convert(com.jme3.math.Quaternion oldQuat) { javax.vecmath.Quat4f newQuat = new javax.vecmath.Quat4f(); convert(oldQuat, newQuat); return newQuat; }
public VMDMotion() { location = new Point3f(); rotation = new Quat4f(); } public VMDMotion(VMDFile vmdFile, DataInputStreamLittleEndian is) throws IOException {
public Quat4f getRotation() { Matrix4d matrix = this.matrixStack.peek(); Quat4f rotation = new Quat4f(); matrix.get(rotation); return rotation; }
public static Quat4f generateRandomQuaternion4f(Random random) { return new Quat4f(generateRandomQuaternion(random, Math.PI)); }
/** * Multiplies this quaternion by the inverse of quaternion q1 and places * the value into this quaternion. The value of the argument quaternion * is preserved (this = this * q^-1). * @param q1 the other quaternion */ public final void mulInverse(Quat4f q1) { Quat4f tempQuat = new Quat4f(q1); tempQuat.inverse(); this.mul(tempQuat); }
/** * Multiplies quaternion q1 by the inverse of quaternion q2 and places * the value into this quaternion. The value of both argument quaternions * is preservered (this = q1 * q2^-1). * @param q1 the first quaternion * @param q2 the second quaternion */ public final void mulInverse(Quat4f q1, Quat4f q2) { Quat4f tempQuat = new Quat4f(q2); tempQuat.inverse(); this.mul(q1, tempQuat); }
@Override public @Nonnull Pair<? extends IBakedModel, Matrix4f> handlePerspective(@Nonnull ItemCameraTransforms.TransformType cameraTransformType) { Pair<? extends IBakedModel, Matrix4f> perspective = parent.handlePerspective(cameraTransformType); double r = (EnderIO.proxy.getTickCount() % 360) + Minecraft.getMinecraft().getRenderPartialTicks(); TRSRTransformation transformOrig = new TRSRTransformation(perspective.getRight()); Quat4f leftRot = transformOrig.getLeftRot(); Quat4f yRotation = new Quat4f(); yRotation.set(new AxisAngle4d(0, 1, 0, Math.toRadians(r * speed))); leftRot.mul(yRotation); TRSRTransformation transformNew = new TRSRTransformation(transformOrig.getTranslation(), leftRot, transformOrig.getScale(), transformOrig.getRightRot()); return Pair.of(perspective.getLeft(), transformNew.getMatrix()); }
public void set(FramePose initialStanceFootPose, RobotSide initialStanceSide, FramePose goalPose) { this.initialStanceSide = initialStanceSide; Point3d tempPoint = new Point3d(); Quat4d tempOrientation = new Quat4d(); initialStanceFootPose.getPosition(tempPoint); initialStanceFootPose.getOrientation(tempOrientation); stanceFootPositionInWorld = new Point3f(tempPoint); stanceFootOrientationInWorld = new Quat4f(tempOrientation); goalPose.getPosition(tempPoint); goalPose.getOrientation(tempOrientation); goalPositionInWorld = new Point3f(tempPoint); goalOrientationInWorld = new Quat4f(tempOrientation); }
public static Transform j3dTransform3DToJMETransform(RigidBodyTransform transform3D) { Quat4f quat = new Quat4f(); javax.vecmath.Vector3f vector = new javax.vecmath.Vector3f(); transform3D.get(quat, vector); Vector3f jmeVector = new Vector3f(vector.getX(), vector.getY(), vector.getZ()); Quaternion jmeQuat = new Quaternion(quat.getX(), quat.getY(), quat.getZ(), quat.getW()); Transform ret = new Transform(jmeVector, jmeQuat, new Vector3f(1.0f, 1.0f, 1.0f)); return ret; }
private static Transform j3dTransform3DToJMETransform(RigidBodyTransform transform3D) { javax.vecmath.Quat4f quat = new javax.vecmath.Quat4f(); javax.vecmath.Vector3f vector = new javax.vecmath.Vector3f(); transform3D.get(quat, vector); Vector3f jmeVector = new Vector3f(vector.getX(), vector.getY(), vector.getZ()); Quaternion jmeQuat = new Quaternion(quat.getX(), quat.getY(), quat.getZ(), quat.getW()); Transform ret = new Transform(jmeVector, jmeQuat, new Vector3f(1.0f, 1.0f, 1.0f)); return ret; }