public Trapeeze(Game game) { Cylinder pole = new Cylinder(10, 10, radius, height, true); leftPole = new Geometry("leftPole", pole); leftPole.rotate(90f * FastMath.DEG_TO_RAD, 0, 0); leftPole.setLocalTranslation(-1f, height / 2f, 0f); leftPole.setShadowMode(RenderQueue.ShadowMode.Cast); rightPole = new Geometry("rightPole", pole); rightPole.rotate(90f * FastMath.DEG_TO_RAD, 0, 0); rightPole.setLocalTranslation(1f, height / 2f, 0f); rightPole.setShadowMode(RenderQueue.ShadowMode.Cast); float betweenPoles = rightPole.getLocalTranslation().x - leftPole.getLocalTranslation().x; Box seat = new Box(betweenPoles, radius, radius * 4); swing = new Geometry("swing", seat); swing.rotate(90f * FastMath.DEG_TO_RAD, 0, 0); swing.setLocalTranslation(0f, 3, 0f); swing.setShadowMode(RenderQueue.ShadowMode.Cast); swing.move(-4.0f, 6f, 0.0f); leftPole.move(-4.0f, 10f, 0.0f); rightPole.move(-4.0f, 10f, 0.0f); setTrapeezeMaterial(Main.matOrange); collisionShape = CollisionShapeFactory.createBoxShape(leftPole); collisionShape = CollisionShapeFactory.createBoxShape(rightPole); collisionShape = CollisionShapeFactory.createBoxShape(swing); this.attachChild(leftPole); this.attachChild(swing); }
private void makeSolid(BulletAppState physicsEngine) { CollisionShape boxShape = CollisionShapeFactory.createBoxShape(this); RigidBodyControl rigidBody = new RigidBodyControl(boxShape, 0.0f); addControl(rigidBody); physicsEngine.getPhysicsSpace().add(rigidBody); }