Quantcast
Channel: Babylon.js
Viewing all articles
Browse latest Browse all 388

Tron like grid for units

$
0
0

I would like to have Tron like grid for units, I have extracted the code for this to a class:


import Common from "./Common";
/**
 *
 * The ground (actually a grid in space) that the game sits upon
 */
export default class Ground {
  mesh:BABYLON.Mesh;
  click:(e:MouseEvent)=>void;

  defaultMaterial:BABYLON.StandardMaterial;

  constructor(scene) {

    //Creation of a material with wireFrame
    this.defaultMaterial = new BABYLON.StandardMaterial("wireframe", scene);
    this.defaultMaterial.wireframe = true;


    this.mesh = BABYLON.Mesh.CreateGround("ground1", Common.MEDIUM_SIZE_MAP, Common.MEDIUM_SIZE_MAP, 10, scene);

    this.defaultMaterial = new BABYLON.StandardMaterial("wireframe", scene);
    this.defaultMaterial.wireframe = true;

    this.mesh.material = this.defaultMaterial;
  }

}

What is the best way to take this forward? Do I need to use a Tiled ground?

 

Currently when panning with this it seems a bit jerky to me. I'm on 2015 mac pro (no GTX card)


Viewing all articles
Browse latest Browse all 388

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>