Search in sources :

Example 26 with Matrix3f

use of com.jme3.math.Matrix3f in project jmonkeyengine by jMonkeyEngine.

the class PhysicsGhostObject method write.

@Override
public void write(JmeExporter e) throws IOException {
    super.write(e);
    OutputCapsule capsule = e.getCapsule(this);
    capsule.write(getPhysicsLocation(new Vector3f()), "physicsLocation", new Vector3f());
    capsule.write(getPhysicsRotationMatrix(new Matrix3f()), "physicsRotation", new Matrix3f());
    capsule.write(getCcdMotionThreshold(), "ccdMotionThreshold", 0);
    capsule.write(getCcdSweptSphereRadius(), "ccdSweptSphereRadius", 0);
}
Also used : OutputCapsule(com.jme3.export.OutputCapsule) Matrix3f(com.jme3.math.Matrix3f) Vector3f(com.jme3.math.Vector3f)

Example 27 with Matrix3f

use of com.jme3.math.Matrix3f in project jmonkeyengine by jMonkeyEngine.

the class PhysicsRigidBody method read.

@Override
public void read(JmeImporter e) throws IOException {
    super.read(e);
    InputCapsule capsule = e.getCapsule(this);
    float mass = capsule.readFloat("mass", 1.0f);
    this.mass = mass;
    rebuildRigidBody();
    setGravity((Vector3f) capsule.readSavable("gravity", Vector3f.ZERO.clone()));
    setFriction(capsule.readFloat("friction", 0.5f));
    setKinematic(capsule.readBoolean("kinematic", false));
    setRestitution(capsule.readFloat("restitution", 0));
    setAngularFactor(capsule.readFloat("angularFactor", 1));
    setDamping(capsule.readFloat("linearDamping", 0), capsule.readFloat("angularDamping", 0));
    setSleepingThresholds(capsule.readFloat("linearSleepingThreshold", 0.8f), capsule.readFloat("angularSleepingThreshold", 1.0f));
    setCcdMotionThreshold(capsule.readFloat("ccdMotionThreshold", 0));
    setCcdSweptSphereRadius(capsule.readFloat("ccdSweptSphereRadius", 0));
    setPhysicsLocation((Vector3f) capsule.readSavable("physicsLocation", new Vector3f()));
    setPhysicsRotation((Matrix3f) capsule.readSavable("physicsRotation", new Matrix3f()));
    joints = capsule.readSavableArrayList("joints", null);
}
Also used : Matrix3f(com.jme3.math.Matrix3f) InputCapsule(com.jme3.export.InputCapsule) Vector3f(com.jme3.math.Vector3f)

Example 28 with Matrix3f

use of com.jme3.math.Matrix3f in project jmonkeyengine by jMonkeyEngine.

the class PhysicsRigidBody method write.

@Override
public void write(JmeExporter e) throws IOException {
    super.write(e);
    OutputCapsule capsule = e.getCapsule(this);
    capsule.write(getMass(), "mass", 1.0f);
    capsule.write(getGravity(), "gravity", Vector3f.ZERO);
    capsule.write(getFriction(), "friction", 0.5f);
    capsule.write(getRestitution(), "restitution", 0);
    capsule.write(getAngularFactor(), "angularFactor", 1);
    capsule.write(kinematic, "kinematic", false);
    capsule.write(constructionInfo.linearDamping, "linearDamping", 0);
    capsule.write(constructionInfo.angularDamping, "angularDamping", 0);
    capsule.write(constructionInfo.linearSleepingThreshold, "linearSleepingThreshold", 0.8f);
    capsule.write(constructionInfo.angularSleepingThreshold, "angularSleepingThreshold", 1.0f);
    capsule.write(getCcdMotionThreshold(), "ccdMotionThreshold", 0);
    capsule.write(getCcdSweptSphereRadius(), "ccdSweptSphereRadius", 0);
    capsule.write(getPhysicsLocation(new Vector3f()), "physicsLocation", new Vector3f());
    capsule.write(getPhysicsRotationMatrix(new Matrix3f()), "physicsRotation", new Matrix3f());
    capsule.writeSavableArrayList(joints, "joints", null);
}
Also used : OutputCapsule(com.jme3.export.OutputCapsule) Matrix3f(com.jme3.math.Matrix3f) Vector3f(com.jme3.math.Vector3f)

Example 29 with Matrix3f

use of com.jme3.math.Matrix3f in project jmonkeyengine by jMonkeyEngine.

the class ConeJoint method write.

@Override
public void write(JmeExporter ex) throws IOException {
    super.write(ex);
    OutputCapsule capsule = ex.getCapsule(this);
    capsule.write(rotA, "rotA", new Matrix3f());
    capsule.write(rotB, "rotB", new Matrix3f());
    capsule.write(angularOnly, "angularOnly", false);
    capsule.write(swingSpan1, "swingSpan1", 1e30f);
    capsule.write(swingSpan2, "swingSpan2", 1e30f);
    capsule.write(twistSpan, "twistSpan", 1e30f);
}
Also used : OutputCapsule(com.jme3.export.OutputCapsule) Matrix3f(com.jme3.math.Matrix3f)

Example 30 with Matrix3f

use of com.jme3.math.Matrix3f in project jmonkeyengine by jMonkeyEngine.

the class ConeJoint method read.

@Override
public void read(JmeImporter im) throws IOException {
    super.read(im);
    InputCapsule capsule = im.getCapsule(this);
    this.rotA = (Matrix3f) capsule.readSavable("rotA", new Matrix3f());
    this.rotB = (Matrix3f) capsule.readSavable("rotB", new Matrix3f());
    this.angularOnly = capsule.readBoolean("angularOnly", false);
    this.swingSpan1 = capsule.readFloat("swingSpan1", 1e30f);
    this.swingSpan2 = capsule.readFloat("swingSpan2", 1e30f);
    this.twistSpan = capsule.readFloat("twistSpan", 1e30f);
    createJoint();
}
Also used : Matrix3f(com.jme3.math.Matrix3f) InputCapsule(com.jme3.export.InputCapsule)

Aggregations

Matrix3f (com.jme3.math.Matrix3f)21 Vector3f (com.jme3.math.Vector3f)10 TempVars (com.jme3.util.TempVars)8 ChildCollisionShape (com.jme3.bullet.collision.shapes.infos.ChildCollisionShape)5 InputCapsule (com.jme3.export.InputCapsule)5 Transform (com.bulletphysics.linearmath.Transform)3 OutputCapsule (com.jme3.export.OutputCapsule)3 CompoundShape (com.bulletphysics.collision.shapes.CompoundShape)2 BoxCollisionShape (com.jme3.bullet.collision.shapes.BoxCollisionShape)2 CollisionShape (com.jme3.bullet.collision.shapes.CollisionShape)2 CompoundCollisionShape (com.jme3.bullet.collision.shapes.CompoundCollisionShape)2 Geometry (com.jme3.scene.Geometry)2 Node (com.jme3.scene.Node)2 Spatial (com.jme3.scene.Spatial)2 VertexBuffer (com.jme3.scene.VertexBuffer)2 ByteBuffer (java.nio.ByteBuffer)2 FloatBuffer (java.nio.FloatBuffer)2 Generic6DofConstraint (com.bulletphysics.dynamics.constraintsolver.Generic6DofConstraint)1 RotationalLimitMotor (com.jme3.bullet.joints.motors.RotationalLimitMotor)1 BitmapFont (com.jme3.font.BitmapFont)1