About Store Forum Documentation Contact



Post Reply 
Explosions + physics
Author Message
darkking Offline
Member

Post: #1
Explosions + physics
Hi !
I have problem. How to join explosions with physics ?

----------
Jestem z Polski wink Więc jeśli by to było możliwe prosiłbym o odpowiedź po polsku.
12-05-2010 03:24 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Explosions + physics
You can add forces/impulses to all nearby actors.
12-05-2010 03:25 PM
Find all posts by this user Quote this message in a reply
darkking Offline
Member

Post: #3
RE: Explosions + physics
Ok, thanks. But how to do it ? I'm already start with Esenthel.
(This post was last modified: 12-05-2010 03:28 PM by darkking.)
12-05-2010 03:27 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
RE: Explosions + physics
Game::World.objGet will give you a list of objects, in each of them
Actor::addImpulse or something like that
12-05-2010 03:29 PM
Find all posts by this user Quote this message in a reply
darkking Offline
Member

Post: #5
RE: Explosions + physics
I wrote this. But it doesn't work.
Code:
Memc<Game::Obj*> objs;
    if(Kb.bp(KB_SPACE))
   {
       explosion.create(main, single, Color(96,20,0,0), 80, Vec(0,0,0), 1);
        //ball.addImpulse(Vec(0,1,1));
        Vec tempPos = ball.pos();
        Game::World.objGet(objs,Ball(2,tempPos));
        REPA(objs)
              {
                     Actor *item = CAST(Actor, objs[i]);
                    
        item->addImpulse(Vec(0,1,1));
                    
            }
   }
   }
(This post was last modified: 12-05-2010 06:27 PM by darkking.)
12-05-2010 06:01 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #6
RE: Explosions + physics
you can't cast Game::Obj to Actor,
check for example Game::Item (which can be casted), it has member 'actor'
12-05-2010 07:02 PM
Find all posts by this user Quote this message in a reply
darkking Offline
Member

Post: #7
RE: Explosions + physics
Ok, i have now this:
Code:
if(Kb.bp(KB_SPACE))
   {
       Memc<Game::Obj*> objs;
       explosion.create(main, single, Color(96,20,0,0), 80, Vec(0,0,0), 1);
        //ball.addImpulse(Vec(0,1,1));
        Vec tempPos = Vec(0,0,0);
        Game::World.objGet(objs,Ball(3,tempPos));
        REPA(objs)
              {
                  Game::Item *item = CAST(Game::Item, objs[i]);
                    
                        item->actor.addImpulse(Vec(0,1,1));
                    
            }
   }
It doesn't work. What do Flt r in
Code:
Game::World.objGet(objs,Ball(3,tempPos));
?
12-05-2010 07:08 PM
Find all posts by this user Quote this message in a reply
Zervox Offline
Member

Post: #8
RE: Explosions + physics
in Ball r is radius.
12-05-2010 07:25 PM
Find all posts by this user Quote this message in a reply
darkking Offline
Member

Post: #9
RE: Explosions + physics
So, it get all objects around 3f from explosion ? Why it doesn't work.
12-05-2010 08:00 PM
Find all posts by this user Quote this message in a reply
Harry Offline
Member

Post: #10
RE: Explosions + physics
Check tutorial Game Basics/Big Overlays. It should helps you.
12-05-2010 09:02 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply