@Override public void read(JmeImporter im) throws IOException { InputCapsule ic = im.getCapsule(this); // NOTE: In previous versions of jME3, initialVelocity was called startVelocity if (ic.getSavableVersion(DefaultParticleInfluencer.class) == 0) { initialVelocity = (Vector3f) ic.readSavable("startVelocity", Vector3f.ZERO.clone()); } else { initialVelocity = (Vector3f) ic.readSavable("initialVelocity", Vector3f.ZERO.clone()); } velocityVariation = ic.readFloat("variation", 0.2f); }
@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); }
@Override public void simpleInitApp() { JmeCanvasContext ctx = (JmeCanvasContext) getContext(); gui = new GUI(this, ctx.getCanvas()); gui.show(); flyCam.setEnabled(false); Box b = new Box(1, 1, 1); Geometry geom = new Geometry("Box", b); Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); mat.setColor("Color", ColorRGBA.Blue); geom.setMaterial(mat); rootNode.attachChild(geom); cinematic = new Cinematic(rootNode, 5); MotionPath path = new MotionPath(); path.addWayPoint(Vector3f.ZERO.clone()); path.addWayPoint(new Vector3f(10, 0, 0)); MotionEvent motionEvent = new MotionEvent(geom, path, 5); cinematic.addCinematicEvent(0, motionEvent); cinematic.fitDuration(); cinematic.setLoopMode(LoopMode.Loop); stateManager.attach(cinematic); }
public void read(JmeImporter e) throws IOException { center = (Vector3f) e.getCapsule(this).readSavable("center", Vector3f.ZERO.clone()); }