Advertisement
Guest User

VoxelTerrainBlock

a guest
Apr 18th, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.81 KB | None | 0 0
  1. package mygame.terrain;
  2.  
  3. import com.jme3.bullet.control.RigidBodyControl;
  4. import com.jme3.scene.Geometry;
  5. import com.jme3.scene.Mesh;
  6. import mygame.Main;
  7.  
  8. public abstract class VoxelTerrainBlock extends Geometry {
  9.  
  10.   protected static final Mesh DEFAULT_MESH = new VoxelBlockMesh().init();
  11.   protected RigidBodyControl physics;
  12.  
  13.   public VoxelTerrainBlock() {
  14.   }
  15.  
  16.   public VoxelTerrainBlock(final String name) {
  17.     this(name, DEFAULT_MESH);
  18.     this.physics = new RigidBodyControl(0);
  19.   }
  20.  
  21.   public VoxelTerrainBlock(final String name, final Mesh mesh) {
  22.     super(name, mesh);
  23.   }
  24.  
  25.   protected void addPhysics() {
  26.     physics.setSpatial(this);
  27.     Main.PHYSICS.getPhysicsSpace().add(physics);
  28.   }
  29.  
  30.   protected void removePhysics() {
  31.     Main.PHYSICS.getPhysicsSpace().remove(physics);
  32.   }
  33.  
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement