/** * Convert a vector (in) from this spatial's local coordinate space to world * coordinate space. * * @param in * vector to read from * @param store * where to write the result (null to create a new vector, may be * same as in) * @return the result (store) */ public Vector3f localToWorld(final Vector3f in, Vector3f store) { checkDoTransformUpdate(); return worldTransform.transformVector(in, store); }
updateBoneMesh(bGeomO, start, ends); bGeom.setUserData("start", getWorldTransform().transformVector(start, start)); for (int i = 0; i < ends.length; i++) { getWorldTransform().transformVector(ends[i], ends[i]);
/** * Compute bounds from an array of points * * @param pts * @param transform * @return */ public static BoundingBox computeBoundForPoints(Vector3f[] pts, Transform transform) { Vector3f min = new Vector3f(Vector3f.POSITIVE_INFINITY); Vector3f max = new Vector3f(Vector3f.NEGATIVE_INFINITY); Vector3f temp = new Vector3f(); for (int i = 0; i < pts.length; i++) { transform.transformVector(pts[i], temp); min.minLocal(temp); max.maxLocal(temp); } Vector3f center = min.add(max).multLocal(0.5f); Vector3f extent = max.subtract(min).multLocal(0.5f); return new BoundingBox(center, extent.x, extent.y, extent.z); }
setColor(bGeom, outlinesAttach == null ? outlineColor : baseColor); geomToJoint.put(bGeom, joint); bGeom.setUserData("start", getWorldTransform().transformVector(start, start)); for (int i = 0; i < ends.length; i++) { getWorldTransform().transformVector(ends[i], ends[i]);
/** * Alter the transforms of a rigidBody to match the transforms of a bone. * This is used to make the ragdoll follow animated motion in Kinematic mode * * @param link the bone link connecting the bone and the rigidBody * @param position temporary storage used in calculations (not null) * @param tmpRot1 temporary storage used in calculations (not null) */ protected void matchPhysicObjectToBone(PhysicsBoneLink link, Vector3f position, Quaternion tmpRot1) { //computing position from rotation and scale targetModel.getWorldTransform().transformVector(link.bone.getModelSpacePosition(), position); //computing rotation tmpRot1.set(link.bone.getModelSpaceRotation()).multLocal(link.bone.getModelBindInverseRotation()); targetModel.getWorldRotation().mult(tmpRot1, tmpRot1); tmpRot1.normalizeLocal(); //updating physics location/rotation of the physics bone link.rigidBody.setPhysicsLocation(position); link.rigidBody.setPhysicsRotation(tmpRot1); }
/** * Alter the transforms of a rigidBody to match the transforms of a bone. * This is used to make the ragdoll follow animated motion in Kinematic mode * * @param link the bone link connecting the bone and the rigidBody * @param position temporary storage used in calculations (not null) * @param tmpRot1 temporary storage used in calculations (not null) */ protected void matchPhysicObjectToBone(PhysicsBoneLink link, Vector3f position, Quaternion tmpRot1) { //computing position from rotation and scale targetModel.getWorldTransform().transformVector(link.bone.getModelSpacePosition(), position); //computing rotation tmpRot1.set(link.bone.getModelSpaceRotation()).multLocal(link.bone.getModelBindInverseRotation()); targetModel.getWorldRotation().mult(tmpRot1, tmpRot1); tmpRot1.normalizeLocal(); //updating physics location/rotation of the physics bone link.rigidBody.setPhysicsLocation(position); link.rigidBody.setPhysicsRotation(tmpRot1); }
worldTransform.transformVector(p.position, p.position); worldTransform.getRotation().mult(p.velocity, p.velocity);
/** * Convert a vector (in) from this spatials' local coordinate space to world * coordinate space. * * @param in * vector to read from * @param store * where to write the result (null to create a new vector, may be * same as in) * @return the result (store) */ public Vector3f localToWorld(final Vector3f in, Vector3f store) { checkDoTransformUpdate(); return worldTransform.transformVector(in, store); }
/** * Convert a vector (in) from this spatial's local coordinate space to world * coordinate space. * * @param in * vector to read from * @param store * where to write the result (null to create a new vector, may be * same as in) * @return the result (store) */ public Vector3f localToWorld(final Vector3f in, Vector3f store) { checkDoTransformUpdate(); return worldTransform.transformVector(in, store); }
/** * Compute bounds from an array of points * * @param pts * @param transform * @return */ public static BoundingBox computeBoundForPoints(Vector3f[] pts, Transform transform) { Vector3f min = new Vector3f(Vector3f.POSITIVE_INFINITY); Vector3f max = new Vector3f(Vector3f.NEGATIVE_INFINITY); Vector3f temp = new Vector3f(); for (int i = 0; i < pts.length; i++) { transform.transformVector(pts[i], temp); min.minLocal(temp); max.maxLocal(temp); } Vector3f center = min.add(max).multLocal(0.5f); Vector3f extent = max.subtract(min).multLocal(0.5f); return new BoundingBox(center, extent.x, extent.y, extent.z); }
/** * Set the transforms of a rigidBody to match the transforms of a bone. * this is used to make the ragdoll follow the skeleton motion while in Kinematic mode * @param link the link containing the bone and the rigidBody * @param position just a temp vector for position * @param tmpRot1 just a temp quaternion for rotation */ private void matchPhysicObjectToBone(PhysicsBoneLink link, Vector3f position, Quaternion tmpRot1) { //computing position from rotation and scale targetModel.getWorldTransform().transformVector(link.bone.getModelSpacePosition(), position); //computing rotation tmpRot1.set(link.bone.getModelSpaceRotation()).multLocal(link.bone.getWorldBindInverseRotation()); targetModel.getWorldRotation().mult(tmpRot1, tmpRot1); tmpRot1.normalizeLocal(); //updating physic location/rotation of the physic bone link.rigidBody.setPhysicsLocation(position); link.rigidBody.setPhysicsRotation(tmpRot1); }
/** * Compute bounds from an array of points * @param pts * @param transform * @return */ public static BoundingBox computeBoundForPoints(Vector3f[] pts, Transform transform) { Vector3f min = new Vector3f(Vector3f.POSITIVE_INFINITY); Vector3f max = new Vector3f(Vector3f.NEGATIVE_INFINITY); Vector3f temp = new Vector3f(); for (int i = 0; i < pts.length; i++) { transform.transformVector(pts[i], temp); min.minLocal(temp); max.maxLocal(temp); } Vector3f center = min.add(max).multLocal(0.5f); Vector3f extent = max.subtract(min).multLocal(0.5f); return new BoundingBox(center, extent.x, extent.y, extent.z); }
/** * Alter the transforms of a rigidBody to match the transforms of a bone. * This is used to make the ragdoll follow animated motion in Kinematic mode * * @param link the bone link connecting the bone and the rigidBody * @param position temporary storage used in calculations (not null) * @param tmpRot1 temporary storage used in calculations (not null) */ protected void matchPhysicObjectToBone(PhysicsBoneLink link, Vector3f position, Quaternion tmpRot1) { //computing position from rotation and scale targetModel.getWorldTransform().transformVector(link.bone.getModelSpacePosition(), position); //computing rotation tmpRot1.set(link.bone.getModelSpaceRotation()).multLocal(link.bone.getModelBindInverseRotation()); targetModel.getWorldRotation().mult(tmpRot1, tmpRot1); tmpRot1.normalizeLocal(); //updating physics location/rotation of the physics bone link.rigidBody.setPhysicsLocation(position); link.rigidBody.setPhysicsRotation(tmpRot1); }
/** * Set the transforms of a rigidBody to match the transforms of a bone. this * is used to make the ragdoll follow the skeleton motion while in Kinematic * mode * * @param link the link containing the bone and the rigidBody * @param position just a temp vector for position * @param tmpRot1 just a temp quaternion for rotation */ protected void matchPhysicObjectToBone(PhysicsBoneLink link, Vector3f position, Quaternion tmpRot1) { //computing position from rotation and scale targetModel.getWorldTransform().transformVector(link.bone.getModelSpacePosition(), position); //computing rotation tmpRot1.set(link.bone.getModelSpaceRotation()).multLocal(link.bone.getModelBindInverseRotation()); targetModel.getWorldRotation().mult(tmpRot1, tmpRot1); tmpRot1.normalizeLocal(); //updating physic location/rotation of the physic bone link.rigidBody.setPhysicsLocation(position); link.rigidBody.setPhysicsRotation(tmpRot1); }
pointTransform.transformVector(p, p);
pointTransform.transformVector(p, p);
pointTransform.transformVector(p, p);
worldTransform.transformVector(p.position, p.position); worldTransform.getRotation().mult(p.velocity, p.velocity);
worldTransform.transformVector(p.position, p.position); worldTransform.getRotation().mult(p.velocity, p.velocity);
dir = worldTransform.transformVector(dir, dir); dl.setDirection(dir.normalizeLocal()); dl.setColor(color); Vector3f pos = worldTransform.transformVector(new Vector3f(), new Vector3f()); pl.setColor(color); pl.setPosition(pos);