protected void createGhostObject() { ghostObject = new PhysicsGhostObject(new SphereCollisionShape(explosionRadius)); }
/** * Instantiate the configured shape in Bullet. */ protected void createShape() { objectId = createShape(radius); Logger.getLogger(this.getClass().getName()).log(Level.FINE, "Created Shape {0}", Long.toHexString(objectId)); // new SphereShape(radius); // objectId.setLocalScaling(Converter.convert(getScale())); // objectId.setMargin(margin); setScale(scale); // Set the scale to 1 setMargin(margin); }
protected void createShape() { cShape = new SphereShape(radius); cShape.setLocalScaling(Converter.convert(getScale())); cShape.setMargin(margin); }
/** * Instantiate a sphere shape with the specified radius. * * @param radius the desired radius (≥0) */ public SphereCollisionShape(float radius) { this.radius = radius; createShape(); }
/** * creates a SphereCollisionShape with the given radius * @param radius */ public SphereCollisionShape(float radius) { this.radius = radius; createShape(); }
@Override public void simpleInitApp() { assetManager.registerLocator(".", FileLocator.class); CollisionShape shape = new SphereCollisionShape(1f); RigidBodyControl rbc = new RigidBodyControl(shape, 1f); setParameters(rbc); verifyParameters(rbc); RigidBodyControl rbcCopy = (RigidBodyControl) saveThenLoad(rbc); verifyParameters(rbcCopy); stop(); }
protected void createShape() { objectId = createShape(radius); Logger.getLogger(this.getClass().getName()).log(Level.INFO, "Created Shape {0}", Long.toHexString(objectId)); // new SphereShape(radius); // objectId.setLocalScaling(Converter.convert(getScale())); // objectId.setMargin(margin); setScale(scale); setMargin(margin); }
/** * 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); radius = capsule.readFloat("radius", 0.5f); createShape(); }
protected void createShape() { cShape = new SphereShape(radius); cShape.setLocalScaling(Converter.convert(getScale())); cShape.setMargin(margin); }
@Override public void simpleInitApp() { CollisionShape capsule = new SphereCollisionShape(1f); PhysicsRigidBody body1 = new PhysicsRigidBody(capsule, 1f); PhysicsRigidBody body2 = new PhysicsRigidBody(capsule, 1f); Vector3f pivot1 = new Vector3f(); Vector3f pivot2 = new Vector3f(); Point2PointJoint joint = new Point2PointJoint(body1, body2, pivot1, pivot2); joint.setImpulseClamp(42f); joint.setTau(99f); if (joint.getImpulseClamp() != 42f) { throw new RuntimeException(); } if (joint.getTau() != 99f) { throw new RuntimeException(); } stop(); } }
protected void createShape() { objectId = createShape(radius); Logger.getLogger(this.getClass().getName()).log(Level.FINE, "Created Shape {0}", Long.toHexString(objectId)); // new SphereShape(radius); // objectId.setLocalScaling(Converter.convert(getScale())); // objectId.setMargin(margin); setScale(scale); // Set the scale to 1 setMargin(margin); }
public void read(JmeImporter im) throws IOException { super.read(im); InputCapsule capsule = im.getCapsule(this); radius = capsule.readFloat("radius", 0.5f); createShape(); }
public void onAction(String name, boolean keyPressed, float tpf) { if (name.equals("shoot") && !keyPressed) { Geometry bulletg = new Geometry("bullet", bullet); bulletg.setMaterial(mat2); bulletg.setShadowMode(ShadowMode.CastAndReceive); bulletg.setLocalTranslation(cam.getLocation()); SphereCollisionShape bulletCollisionShape = new SphereCollisionShape(0.4f); RigidBodyControl bulletNode = new BombControl(assetManager, bulletCollisionShape, 1); // RigidBodyControl bulletNode = new RigidBodyControl(bulletCollisionShape, 1); bulletNode.setLinearVelocity(cam.getDirection().mult(25)); bulletg.addControl(bulletNode); rootNode.attachChild(bulletg); getPhysicsSpace().add(bulletNode); } if (name.equals("gc") && !keyPressed) { System.gc(); } } };
/** * creates a SphereCollisionShape with the given radius * @param radius */ public SphereCollisionShape(float radius) { this.radius = radius; createShape(); }
private void prepareBullet() { bullet = new Sphere(32, 32, 0.4f, true, false); bullet.setTextureMode(TextureMode.Projected); bulletCollisionShape = new SphereCollisionShape(0.4f); matBullet = new Material(getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md"); matBullet.setColor("Color", ColorRGBA.Green); matBullet.setColor("GlowColor", ColorRGBA.Green); getPhysicsSpace().addCollisionListener(this); }
/** * creates a SphereCollisionShape with the given radius * @param radius */ public SphereCollisionShape(float radius) { this.radius = radius; createShape(); }
@Override public void simpleInitApp() { CollisionShape capsule = new SphereCollisionShape(1f); PhysicsRigidBody body1 = new PhysicsRigidBody(capsule, 1f); PhysicsRigidBody body2 = new PhysicsRigidBody(capsule, 1f); Vector3f pivot1 = new Vector3f(); Vector3f pivot2 = new Vector3f(); SixDofJoint joint = new SixDofJoint(body1, body2, pivot1, pivot2, true); joint.getTranslationalLimitMotor().getLimitSoftness(); stop(); } }
/** * creates a SphereCollisionShape with the given radius * @param radius */ public SphereCollisionShape(float radius) { this.radius = radius; createShape(); }
@Override public void simpleInitApp() { CollisionShape capsule = new SphereCollisionShape(1f); PhysicsRigidBody body = new PhysicsRigidBody(capsule, 1f); assert body.getAngularSleepingThreshold() == 1f; assert body.getLinearSleepingThreshold() == 0.8f; body.setAngularSleepingThreshold(0.03f); assert body.getAngularSleepingThreshold() == 0.03f; float lst = body.getLinearSleepingThreshold(); assert lst == 0.8f : lst; // fails, actual value is 1f body.setLinearSleepingThreshold(0.17f); float ast = body.getAngularSleepingThreshold(); assert ast == 0.03f : ast; // fails, actual value is 1f stop(); } }
public void read(JmeImporter im) throws IOException { super.read(im); InputCapsule capsule = im.getCapsule(this); radius = capsule.readFloat("radius", 0.5f); createShape(); }