/** * 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); }
/** * 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(); }
@Override public float addSingleResult(LocalConvexResult lcr, boolean bln) { PhysicsCollisionObject obj = (PhysicsCollisionObject) lcr.hitCollisionObject.getUserPointer(); results.add(new PhysicsSweepTestResult(obj, Converter.convert(lcr.hitNormalLocal), lcr.hitFraction, bln)); return lcr.hitFraction; } }
/** * Gets the physics object rotation as a matrix, no conversions and no object instantiation * @param rotation the rotation of the actual physics object is stored in this Matrix3f */ public Matrix3f getPhysicsRotationMatrix(Matrix3f rotation) { if (rotation == null) { rotation = new Matrix3f(); } rBody.getCenterOfMassTransform(tempTrans); return Converter.convert(tempTrans.basis, rotation); }
/** * Gets the physics object rotation as a quaternion, converts the bullet Matrix3f value * @param rotation the rotation of the actual physics object is stored in this Quaternion */ public Quaternion getPhysicsRotation(Quaternion rotation){ if (rotation == null) { rotation = new Quaternion(); } rBody.getCenterOfMassTransform(tempTrans); return Converter.convert(tempTrans.basis, rotation); }
/** * Gets the physics object rotation * @param rotation the rotation of the actual physics object is stored in this Matrix3f */ public Matrix3f getInterpolatedPhysicsRotation(Matrix3f rotation) { if (rotation == null) { rotation = new Matrix3f(); } rBody.getInterpolationWorldTransform(tempTrans); return Converter.convert(tempTrans.basis, rotation); }
/** * Apply a torque impulse to the PhysicsRigidBody in the next physics update. * @param vec */ public void applyTorqueImpulse(final Vector3f vec) { rBody.applyTorqueImpulse(Converter.convert(vec, tempVec)); rBody.activate(); }
/** * Sets the angular velocity of this PhysicsRigidBody * @param vec the angular velocity of this PhysicsRigidBody */ public void setAngularVelocity(Vector3f vec) { rBody.setAngularVelocity(Converter.convert(vec, tempVec)); rBody.activate(); }
/** * @return the physicsLocation */ public Vector3f getPhysicsLocation() { gObject.getWorldTransform(tempTrans); Converter.convert(tempTrans.origin, physicsLocation.getTranslation()); return physicsLocation.getTranslation(); }
/** * @return the physicsLocation */ public Vector3f getPhysicsLocation(Vector3f trans) { if (trans == null) { trans = new Vector3f(); } gObject.getWorldTransform(tempTrans); Converter.convert(tempTrans.origin, physicsLocation.getTranslation()); return trans.set(physicsLocation.getTranslation()); }
/** * @return the physicsLocation */ public Vector3f getPhysicsLocation(Vector3f trans) { if (trans == null) { trans = new Vector3f(); } gObject.getWorldTransform(tempTrans); Converter.convert(tempTrans.origin, physicsLocation.getTranslation()); return trans.set(physicsLocation.getTranslation()); }
/** * @return the physicsLocation */ public Quaternion getPhysicsRotation(Quaternion rot) { if (rot == null) { rot = new Quaternion(); } gObject.getWorldTransform(tempTrans); Converter.convert(tempTrans.getRotation(tempRot), physicsLocation.getRotation()); return rot.set(physicsLocation.getRotation()); }
protected void createShape(float[] points) { ObjectArrayList<Vector3f> pointList = new ObjectArrayList<Vector3f>(); for (int i = 0; i < points.length; i += 3) { pointList.add(new Vector3f(points[i], points[i + 1], points[i + 2])); } cShape = new ConvexHullShape(pointList); cShape.setLocalScaling(Converter.convert(getScale())); cShape.setMargin(margin); }