• About
  • Gallery of Images
  • Archives
  • Categories
  •   Hour 13 – annoying bug gone!

    29/09/10 - 20:13

    Hey there, been a nice and productive hour 🙂

    Graphically, I’ve added a black background image, and added a texture to the plane at the back of the play field. I think this helps a lot in giving the impression you are actually in a crater 🙂

    Most of the time was actually spent addressing a bug which had been annoying me for a while. When you fire the laser, and hits something, two objects are created, a light and a cube which deforms the terrain.  This is all good, but as I am running this in an Update() loop, it meant holding down the mouse for a second sometimes results into hundreds of items being created.  D’oh!  So after some reading, I discovered I could grab the number of objects of a certain type.  So by placing an if around the object creation section, it was very simple to cap the items.  The video shows you how to tag an object (which I will be uploading just after this).  The code used looks something like this :

    var meltingObjects : int = GameObject.FindGameObjectsWithTag("meltingObject").Length;
    if ( meltingObjects < 5 )
    {
    var MeltyCube = Instantiate ( MeltyCube , hit.point, transform.rotation );
    var evilgreenglow = Instantiate ( evilgreenglow , hit.point, transform.rotation );
    }

    Pretty simple and incredibly helpful, now I can blast away at rock for hours without having to worry about a million item sitting there 🙂  Oh, which reminds me, I’ve also been playing around with creating the ore in bands, with some overlap, I forgot to show that in the video, so will just add a quick screenshot now :

    It’s a rough model of the system I want, but gives you the idea of how I want the ores spread around the asteroid. In that screenshot they are floating 100 units above the terrain which is why it looks like they are out of the mine 🙂

    One last thing, I’ve encoded with the ffdshow codec.  Hopefully you get a better frame rate now 🙂  Will start uploading the video now, tune in tomorrow for another hour 🙂

    Edit : Youtube vid here : ( hopefully this one works! )

    lamentconfig
    Share

    Your Reply


    %d bloggers like this: