Results 1 to 4 of 4

Thread: How to explode your model

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2001

    How to explode your model

    I saw a rather cool effect in the game GLTron ( if you don't know it, take a look at )

    It's a kind of motorcycle game. When you crash, it paints a bitmap onto the wall you crashed into and, most importantly, it causes the polygons making up the cycle to fly away as if they were exploding. The key thing is that the polygon do not change size, so they lose contact to each other. My question is, how do you do that? My best guess would be something like this:

    float timeSinceCrash;
    vector<MyPolyClass> polys;
    for(int i=0; i<POLYGON_NUMBER; i++){
    glScalef(timeSinceCrash, timeSinceCrash, timeSinceCrash);
    translatef(polys[i].x, polys[i].y, polys[i].z);
    glScalef(1/timeSinceCrash, 1/timeSinceCrash, 1/timeSinceCrash);

    So when you translate to the polygon's position, the coordinate system is distorted, but when you actually draw it, it's back to normal, so the polygons are the same size as always.

  2. #2
    Member Newbie
    Join Date
    Mar 2001

    Re: How to explode your model

    I am a little confused on your data structure that you are using but I will give it a shot.

    You will need to loop through your polys but instead of scaling the points you may want to translate the points via a vector away from the center of gravity of the object or perhaps a more realisic explosion using a vector from the point of contact. After all adding is faster than multiplying.

    Other than that the theory looks good.

    Like I said before I am not sure how you are storing your data, but you may want to keep in mind that when the original object was together the polys were sharing the same point with adjacent polys. When the object is exploding, each point that is used by another poly will indeed split into two or more points possibly traveling in a different direction when the explosion occurs.

  3. #3
    Senior Member Regular Contributor
    Join Date
    Sep 2000
    Vancouver BC Canada

    Re: How to explode your model


    why don't you download the source code?

  4. #4
    Member Contributor bsperlin's Avatar
    Join Date
    Feb 2001

    Re: How to explode your model

    Just to get a minor detail in the discussion out of the way, the data structure is fine. I use it for a model with hundreds of thousands of polys and the speed and access work well.

Similar Threads

  1. Replies: 1
    Last Post: 02-20-2014, 08:35 PM
  2. Replies: 0
    Last Post: 11-21-2012, 11:49 AM
  3. Replies: 1
    Last Post: 06-02-2006, 11:52 AM
  4. how to do model clothing & multi-model texturing.
    By Deepak Roy Chittajallu in forum OpenGL: Advanced Coding
    Replies: 6
    Last Post: 11-19-2004, 07:26 PM
  5. How would you explode a piece like this?
    By Succinct in forum OpenGL: Advanced Coding
    Replies: 3
    Last Post: 11-21-2000, 08:27 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Proudly hosted by Digital Ocean