darkking
Member
|
Explosions + physics
Hi !
I have problem. How to join explosions with physics ?
----------
Jestem z Polski Więc jeśli by to było możliwe prosiłbym o odpowiedź po polsku.
|
|
12-05-2010 03:24 PM |
|
Esenthel
Administrator
|
RE: Explosions + physics
You can add forces/impulses to all nearby actors.
|
|
12-05-2010 03:25 PM |
|
darkking
Member
|
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 |
|
Esenthel
Administrator
|
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 |
|
darkking
Member
|
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 |
|
Esenthel
Administrator
|
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 |
|
darkking
Member
|
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 |
|
Zervox
Member
|
RE: Explosions + physics
in Ball r is radius.
|
|
12-05-2010 07:25 PM |
|
darkking
Member
|
RE: Explosions + physics
So, it get all objects around 3f from explosion ? Why it doesn't work.
|
|
12-05-2010 08:00 PM |
|
Harry
Member
|
RE: Explosions + physics
Check tutorial Game Basics/Big Overlays. It should helps you.
|
|
12-05-2010 09:02 PM |
|