/** * returns the location where the wheel collides with the ground (world space) */ public Vector3f getCollisionLocation() { return Converter.convert(wheelInfo.raycastInfo.contactPointWS); }
/** * creates a jme mesh from the collision shape, only needed for debugging */ public Mesh createJmeMesh(){ return Converter.convert(bulletMesh); }
/** * returns the normal where the wheel collides with the ground (world space) */ public Vector3f getCollisionNormal() { return Converter.convert(wheelInfo.raycastInfo.contactNormalWS); }
/** * Get the current angular velocity of this PhysicsRigidBody * @return the current linear velocity */ public Vector3f getAngularVelocity() { return Converter.convert(rBody.getAngularVelocity(tempVec)); }
/** * Get the current linear velocity of this PhysicsRigidBody * @return the current linear velocity */ public Vector3f getLinearVelocity() { return Converter.convert(rBody.getLinearVelocity(tempVec)); }
public static javax.vecmath.Matrix3f convert(com.jme3.math.Matrix3f oldMatrix) { javax.vecmath.Matrix3f newMatrix = new javax.vecmath.Matrix3f(); convert(oldMatrix, newMatrix); return newMatrix; }
/** * Set the local gravity of this PhysicsRigidBody<br/> * Set this after adding the node to the PhysicsSpace, * the PhysicsSpace assigns its current gravity to the physics node when its added. * @param gravity the gravity vector to set */ public void setGravity(Vector3f gravity) { rBody.setGravity(Converter.convert(gravity, tempVec)); }
/** * Apply an impulse to the PhysicsRigidBody in the next physics update. * @param impulse applied impulse * @param rel_pos location relative to object */ public void applyImpulse(final Vector3f impulse, final Vector3f rel_pos) { rBody.applyImpulse(Converter.convert(impulse, tempVec), Converter.convert(rel_pos, tempVec2)); rBody.activate(); }
/** * Sets the gravity of the PhysicsSpace, set before adding physics objects! * @param gravity */ public void setGravity(Vector3f gravity) { dynamicsWorld.setGravity(Converter.convert(gravity)); }
private void createCollisionMesh(Mesh mesh, Vector3f worldScale) { this.worldScale = worldScale; bulletMesh = Converter.convert(mesh); this.numVertices = bulletMesh.numVertices; this.numTriangles = bulletMesh.numTriangles; this.vertexStride = bulletMesh.vertexStride; this.triangleIndexStride = bulletMesh.triangleIndexStride; this.triangleIndexBase = bulletMesh.triangleIndexBase; this.vertexBase = bulletMesh.vertexBase; createShape(); }
public static com.jme3.math.Vector3f convert(javax.vecmath.Vector3f oldVec) { com.jme3.math.Vector3f newVec = new com.jme3.math.Vector3f(); convert(oldVec, newVec); return newVec; }
public static com.jme3.math.Matrix3f convert(javax.vecmath.Matrix3f oldMatrix) { com.jme3.math.Matrix3f newMatrix = new com.jme3.math.Matrix3f(); convert(oldMatrix, newMatrix); return newMatrix; }
/** * Apply a force to the PhysicsRigidBody, only applies force if the next physics update call * updates the physics space.<br> * To apply an impulse, use applyImpulse, use applyContinuousForce to apply continuous force. * @param force the force * @param location the location of the force */ public void applyForce(final Vector3f force, final Vector3f location) { rBody.applyForce(Converter.convert(force, tempVec), Converter.convert(location, tempVec2)); rBody.activate(); }
/** * Performs a ray collision test and returns the results as a list of PhysicsRayTestResults */ public List<PhysicsRayTestResult> rayTest(Vector3f from, Vector3f to) { List<PhysicsRayTestResult> results = new LinkedList<PhysicsRayTestResult>(); dynamicsWorld.rayTest(Converter.convert(from, rayVec1), Converter.convert(to, rayVec2), new InternalRayListener(results)); return results; }
public static javax.vecmath.Vector3f convert(com.jme3.math.Vector3f oldVec) { javax.vecmath.Vector3f newVec = new javax.vecmath.Vector3f(); convert(oldVec, newVec); return newVec; }
protected void createJoint() { Transform transA = new Transform(Converter.convert(rotA)); Converter.convert(pivotA, transA.origin); Converter.convert(rotA, transA.basis); Transform transB = new Transform(Converter.convert(rotB)); Converter.convert(pivotB, transB.origin); Converter.convert(rotB, transB.basis); constraint = new ConeTwistConstraint(nodeA.getObjectId(), nodeB.getObjectId(), transA, transB); ((ConeTwistConstraint) constraint).setLimit(swingSpan1, swingSpan2, twistSpan); ((ConeTwistConstraint) constraint).setAngularOnly(angularOnly); } }