Destruction in Irrlicht

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
jaworekplay
Posts: 36
Joined: Mon Jan 23, 2012 11:14 pm
Location: Lancs, UK

Re: Destruction in Irrlicht

Post by jaworekplay »

OK. And yes it already exists the wrapper for physx 2.x.x series but not for 3.x.x series. That's what I meant by adding functionality. Here is what I wanted to :
Player shoots at the wall and if the gun is powerful enough than pieces of the wall fall down.
Abraxas)
Posts: 227
Joined: Sun Oct 18, 2009 7:24 am

Re: Destruction in Irrlicht

Post by Abraxas) »

I would do something along these lines.

Code: Select all

wall = smgr->addMeshSceneNode
    wall->setID(100) //strength
    wall->setname("destructible")
    ITriangleSelector...bla bla bla
 
if (collision ray)
 if ((stringw) node->getname() = (stringw)"destructible")
 if (node->getid() > player[firing]->getweaponpower())
 breakwall(node);
 
breakwall(ISceneNode* node)
{
// Remove node mesh
// Replace with certain array in a class
}
Then process your class' objets every frame doing getCollisionPosition and updating velocity every frame.

Personally, for collision, I do this with GCP:

Code: Select all

 
if (triout.getArea()) //if there's a collision
{
 
    vector3df wallnormal = triout.getPlane().Normal; //This is the direction we cannot move in.; 
    obj->plane->v -= wallnormal * obj->plane->v.dotProduct(wallnormal) * 2; //Bounce back!
    obj->plane->v *= 0.5; //Bounciness  
    da -= wallnormal * da.dotProduct(wallnormal);
    obj->plane->p += wallnormal * 0.01; //Shove the thing out of the way
 
 
}
jaworekplay
Posts: 36
Joined: Mon Jan 23, 2012 11:14 pm
Location: Lancs, UK

Re: Destruction in Irrlicht

Post by jaworekplay »

This is assuming that I already have my object tessellated ... . Looks interesting.
Thanks for reply and patience ;)
Abraxas)
Posts: 227
Joined: Sun Oct 18, 2009 7:24 am

Re: Destruction in Irrlicht

Post by Abraxas) »

Using a 3d modelling program is an essential skill for making 3d games. Take the time to learn a free one like Blender.
ACE247
Posts: 704
Joined: Tue Mar 16, 2010 12:31 am

Re: Destruction in Irrlicht

Post by ACE247 »

Ehh! Blender isn't just "a free one"!
It's a very good one too! This demonstrated by the fact that Blender comes with a superb voronoi Cell Fracture addon, so you can really easily create your destroyed objects and export them. ;)
See Using the Cell Fracture Add-on in Blender
Abraxas)
Posts: 227
Joined: Sun Oct 18, 2009 7:24 am

Re: Destruction in Irrlicht

Post by Abraxas) »

That's amazing ace, it may be even better than 3ds' standard algorithm.
jaworekplay
Posts: 36
Joined: Mon Jan 23, 2012 11:14 pm
Location: Lancs, UK

Re: Destruction in Irrlicht

Post by jaworekplay »

Hi ACE247!
Thanks for the advice. Ill try blender. And maybe replace chunks of broken wall with PhysX cubes.
Again Thanks.
jaworekplay
Posts: 36
Joined: Mon Jan 23, 2012 11:14 pm
Location: Lancs, UK

Re: Destruction in Irrlicht

Post by jaworekplay »

Omg! Didn't know that blender is so cool. Sorry if I sound like teenager but that video from ace just amazing!
jaworekplay
Posts: 36
Joined: Mon Jan 23, 2012 11:14 pm
Location: Lancs, UK

Re: Destruction in Irrlicht

Post by jaworekplay »

Hello again ;)
At the moment I'm trying to get the Blender destructed files to work with irrlicht ;) btw Blender ...8).
Although Blender has pretty much solved my issue with destruction, I would still like to get APEX to work as well. So, I saw a book "Irrlicht Beginners Guide". Would that book help me with getting APEX to work?
Thanks in advance for replies and for patience ;)
Post Reply