/** * Instantiate an enabled control. */ public KinematicRagdollControl() { baseRigidBody = new PhysicsRigidBody(new BoxCollisionShape(Vector3f.UNIT_XYZ.mult(0.1f)), 1); baseRigidBody.setKinematic(mode == Mode.Kinematic); }
private native long createShape(Vector3f halfExtents);
protected void createShape() { cShape = new BoxShape(Converter.convert(halfExtents)); cShape.setLocalScaling(Converter.convert(getScale())); cShape.setMargin(margin); }
/** * creates a collision box from the given halfExtents * @param halfExtents the halfExtents of the CollisionBox */ public BoxCollisionShape(Vector3f halfExtents) { this.halfExtents = halfExtents; createShape(); }
/** * Instantiate a box shape with the specified half extents. * * @param halfExtents the desired unscaled half extents (not null, no * negative component, alias created) */ public BoxCollisionShape(Vector3f halfExtents) { this.halfExtents = halfExtents; createShape(); }
/** * Instantiate an enabled control. */ public KinematicRagdollControl() { baseRigidBody = new PhysicsRigidBody(new BoxCollisionShape(Vector3f.UNIT_XYZ.mult(0.1f)), 1); baseRigidBody.setKinematic(mode == Mode.Kinematic); }
private native long createShape(Vector3f halfExtents);
public void read(JmeImporter im) throws IOException { super.read(im); InputCapsule capsule = im.getCapsule(this); Vector3f halfExtents = (Vector3f) capsule.readSavable("halfExtents", new Vector3f(1, 1, 1)); this.halfExtents = halfExtents; createShape(); }
protected void createShape() { cShape = new BoxShape(Converter.convert(halfExtents)); cShape.setLocalScaling(Converter.convert(getScale())); cShape.setMargin(margin); }
private void initGhostObject() { Vector3f halfExtents = new Vector3f(3, 4.2f, 1); ghostControl = new GhostControl(new BoxCollisionShape(halfExtents)); Node node=new Node("Ghost Object"); node.addControl(ghostControl); rootNode.attachChild(node); getPhysicsSpace().add(ghostControl); }
private native long createShape(Vector3f halfExtents);
/** * De-serialize this shape, for example when loading from a J3O file. * * @param im importer (not null) * @throws IOException from importer */ public void read(JmeImporter im) throws IOException { super.read(im); InputCapsule capsule = im.getCapsule(this); Vector3f halfExtents = (Vector3f) capsule.readSavable("halfExtents", new Vector3f(1, 1, 1)); this.halfExtents = halfExtents; createShape(); }
/** * Use the bounding box of the supplied spatial to create a * BoxCollisionShape. * * @param spatial the spatial on which to base the shape (not null) * @param parent unused * @return a new shape with the dimensions of the spatial's bounding box * (not null) */ private static BoxCollisionShape createSingleBoxShape(Spatial spatial, Spatial parent) { //TODO: using world bound here instead of "local world" bound... BoxCollisionShape shape = new BoxCollisionShape( ((BoundingBox) spatial.getWorldBound()).getExtent(new Vector3f())); return shape; }
/** * creates a collision box from the given halfExtents * @param halfExtents the halfExtents of the CollisionBox */ public BoxCollisionShape(Vector3f halfExtents) { this.halfExtents = halfExtents; createShape(); }
/** * Use the bounding box of the supplied spatial to create a * BoxCollisionShape. * * @param spatial the spatial on which to base the shape (not null) * @param parent unused * @return a new shape with the dimensions of the spatial's bounding box * (not null) */ private static BoxCollisionShape createSingleBoxShape(Spatial spatial, Spatial parent) { //TODO: using world bound here instead of "local world" bound... BoxCollisionShape shape = new BoxCollisionShape( ((BoundingBox) spatial.getWorldBound()).getExtent(new Vector3f())); return shape; }
/** * creates a collision box from the given halfExtents * @param halfExtents the halfExtents of the CollisionBox */ public BoxCollisionShape(Vector3f halfExtents) { this.halfExtents = halfExtents; createShape(); }
public void initFloor() { Box floorBox = new Box(10f, 0.1f, 5f); floorBox.scaleTextureCoordinates(new Vector2f(3, 6)); Geometry floor = new Geometry("floor", floorBox); floor.setMaterial(mat3); floor.setShadowMode(ShadowMode.Receive); floor.setLocalTranslation(0, -0.1f, 0); floor.addControl(new RigidBodyControl(new BoxCollisionShape(new Vector3f(10f, 0.1f, 5f)), 0)); this.rootNode.attachChild(floor); this.getPhysicsSpace().add(floor); }
/** * creates a collision box from the given halfExtents * @param halfExtents the halfExtents of the CollisionBox */ public BoxCollisionShape(Vector3f halfExtents) { this.halfExtents = halfExtents; createShape(); }
/** * Serialize this shape, for example when saving to a J3O file. * * @param ex exporter (not null) * @throws IOException from exporter */ public void write(JmeExporter ex) throws IOException { OutputCapsule capsule = ex.getCapsule(this); capsule.write(location, "location", new Vector3f()); capsule.write(rotation, "rotation", new Matrix3f()); capsule.write(shape, "shape", new BoxCollisionShape(new Vector3f(1, 1, 1))); }
public void read(JmeImporter im) throws IOException { super.read(im); InputCapsule capsule = im.getCapsule(this); Vector3f halfExtents = (Vector3f) capsule.readSavable("halfExtents", new Vector3f(1, 1, 1)); this.halfExtents = halfExtents; createShape(); }