/** * used internally, not safe */ public void calculateLocalInertia(float mass, javax.vecmath.Vector3f vector) { if (cShape == null) { return; } if (this instanceof MeshCollisionShape) { vector.set(0, 0, 0); } else { cShape.calculateLocalInertia(mass, vector); } }
@Override public void setLocation(org.terasology.math.geom.Vector3f loc) { collider.getWorldTransform(temp); temp.origin.set(VecMath.to(loc)); collider.setWorldTransform(temp); }
@Override public void setLocation(org.terasology.math.geom.Vector3f location) { rb.getWorldTransform(pooledTransform); pooledTransform.origin.set(VecMath.to(location)); rb.proceedToTransform(pooledTransform); }
@Override public void setTransform(org.terasology.math.geom.Vector3f location, org.terasology.math.geom.Quat4f orientation) { rb.getWorldTransform(pooledTransform); pooledTransform.origin.set(VecMath.to(location)); pooledTransform.setRotation(VecMath.to(orientation)); rb.proceedToTransform(pooledTransform); }
/** * Re-calculates the Orientation of this quad, * optionally the normal vector. * * @param setNormal If the normal vector should be updated. */ public void calculateOrientation( boolean setNormal ) { this.v1.set( this.vertices[3].vec ); this.t.set( this.vertices[1].vec ); this.v1.sub( this.t ); this.v2.set( this.vertices[2].vec ); this.t.set( this.vertices[0].vec ); this.v2.sub( this.t ); this.normal.cross( this.v2, this.v1 ); this.normal.normalize(); if( this.format.hasNormal && setNormal) { for( Vertex vertex : this.vertices ) { vertex.normal[0] = this.normal.x; vertex.normal[1] = this.normal.y; vertex.normal[2] = this.normal.z; vertex.normal[3] = 0; } } this.orientation = EnumFacing.getFacingFromVector( this.normal.x, this.normal.y, this.normal.z ); }
public void setPelvisAngularVelocity(Vector3d pelvisAngularVelocityToPack) { pelvisAngularVelocity.set(pelvisAngularVelocityToPack); }
@Override public void getLinearAccelerationMeasurement(Vector3f linearAccelerationToPack) { linearAccelerationToPack.set(linearAccelerationMeasurement); }
public void setDisp(double x, double y, double z) { disp.set((float)x, (float)y, (float)z); // disp.set(1, y); }
public void setRootTranslation(Vector3d rootTranslation) { this.desiredRootTranslation.set(rootTranslation); }
public void setPelvisLinearAcceleration(Vector3d pelvisLinearAcceleration) { this.pelvisLinearAcceleration.set(pelvisLinearAcceleration); }
public void setRootTranslation(Vector3d rootTranslation) { this.rootTranslation.set(rootTranslation); }
public void setPelvisLinearVelocity(Vector3d pelvisLinearVelocityToPack) { pelvisLinearVelocity.set(pelvisLinearVelocityToPack); }
@Override public void getAngularVelocityMeasurement(Vector3f angularVelocityToPack) { angularVelocityToPack.set(angularVelocityMeasurement); }
public static Vector3f readVector3f(ByteBuffer bb, Vector3f v) { v.set(bb.getFloat(), bb.getFloat(), bb.getFloat()); return v; } public static Vector3f writeVector3f(ByteBuffer bb, Vector3f v) {
/** * used internally, not safe */ public void calculateLocalInertia(float mass, javax.vecmath.Vector3f vector) { if (cShape == null) { return; } if (this instanceof MeshCollisionShape) { vector.set(0, 0, 0); } else { cShape.calculateLocalInertia(mass, vector); } }
@Override public void set(KinematicsToolboxOutputStatus other) { if (desiredJointAngles == null) { desiredJointAngles = new float[other.desiredJointAngles.length]; jointNameHash = other.jointNameHash; } else { if (other.desiredJointAngles.length != desiredJointAngles.length) throw new RuntimeException("Array size does not match"); if (jointNameHash != other.jointNameHash) throw new RuntimeException("Joint name hashes are different."); } for (int i = 0; i < desiredJointAngles.length; i++) desiredJointAngles[i] = other.desiredJointAngles[i]; desiredRootTranslation.set(other.desiredRootTranslation); desiredRootOrientation.set(other.desiredRootOrientation); uniqueId = other.uniqueId; destination = other.destination; solutionQuality = other.solutionQuality; }
public static Vector3f readVector3f(DataInputStreamLittleEndian is, Vector3f v) throws IOException { v.set(is.readFloat(), is.readFloat(), -is.readFloat()); return v; }
private static Vector3f[] findNormalsPerFace(int[] indices, Point3f[] vertices) { Vector3f[] normalsPerFace = new Vector3f[indices.length / 3]; // Abuse integer division. Vector3f firstVector = new Vector3f(); Vector3f secondVector = new Vector3f(); Point3f[] faceVertices = new Point3f[3]; for (int face = 0; face < normalsPerFace.length; face++) { normalsPerFace[face] = new Vector3f(); for (int i = 0; i < faceVertices.length; i++) { faceVertices[i] = vertices[indices[face * 3 + i]]; } firstVector.set(faceVertices[2]); firstVector.sub(faceVertices[0]); secondVector.set(faceVertices[2]); secondVector.sub(faceVertices[1]); normalsPerFace[face].cross(firstVector, secondVector); normalsPerFace[face].normalize(); } return normalsPerFace; }
/** * Append a mesh to this. * @param other the mesh to append. Not modified. * @param updateTriangleIndices whether the indices of the given mesh should be updated when appended. Highly recommended, set it to false only if you what you are doing. */ public void add(ModifiableMeshDataHolder other, boolean updateTriangleIndices) { if (updateTriangleIndices) { int shift = vertices.size(); for (int i = 0; i < other.triangleIndices.size(); i++) triangleIndices.add(other.triangleIndices.get(i) + shift); } else { triangleIndices.addAll(other.triangleIndices); } for (int i = 0; i < other.vertices.size(); i++) vertices.add().set(other.vertices.get(i)); for (int i = 0; i < other.texturePoints.size(); i++) texturePoints.add().set(other.texturePoints.get(i)); for (int i = 0; i < other.vertexNormals.size(); i++) vertexNormals.add().set(other.vertexNormals.get(i)); } }