Spawning/moving object chunks at explosion

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.
Post Reply
Kurasiu
Posts: 4
Joined: Thu Dec 06, 2012 4:48 pm

Spawning/moving object chunks at explosion

Post by Kurasiu »

Hello everybody! My first topic here, haha. The subject's name may be a bit unclear so I'll try to explain it as best as I can:

Basicly I have a bit of code that checks whether the moving object "Bullet" collides with any other destuctable object. If the bullet collides with such object it deletes both of them and creates an explosion particle emitter in the place of the deleted destructable object.
However, what I would like to do here is to spawn several "chunks" from this destructable object (as separate, low-poly models) in the place where it was deleted and move them along an arch with a random, slow rotation, to better simulate its explosion, then, after a set amount of time (~3 seconds) delete them from the scene. Maybe it's a bit unclear so let this gif help you understand the idea better:
Image

Any idea/code example how to do it correctly? To simplify things the chunks don't need to have any physics or colliders (i.e. can run through anything freely) attached to them.
zapada
Posts: 4
Joined: Mon Oct 29, 2012 10:09 am

Re: Spawning/moving object chunks at explosion

Post by zapada »

I think you need to use triangle mesh :-??
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: Spawning/moving object chunks at explosion

Post by Mel »

Use 2 diferent objects. One complete, and the other with the animation of the destruction, then, when the object gets destroyed, swap the meshes.
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Abraxas)
Posts: 227
Joined: Sun Oct 18, 2009 7:24 am

Re: Spawning/moving object chunks at explosion

Post by Abraxas) »

Do a forum search for "destruction in irrlicht" I answered this question a couple days ago
Kurasiu
Posts: 4
Joined: Thu Dec 06, 2012 4:48 pm

Re: Spawning/moving object chunks at explosion

Post by Kurasiu »

Ok, to sum it up, I'm using

Code: Select all

 
    m_pChunk=vector3df(last_x, last_y, last_z);
    m_pChunk->setPosition(m_pAnimatedMeshPosition);
 
to set the chunk's position, then using own setChunkRotation/changeChunkRotation methods to rotate it. However any idea how to move it along a nice arch, like on the gif and then delete them after a specific amount of time? Can't really create it as a 3d animation, as I'm not really a 3d modeler/animator by myself. :P And I'm not working with the modeler who did the models for this game anymore.
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: Spawning/moving object chunks at explosion

Post by Mel »

Use a ballistic equation. Choose a random vector to specify a linear speed and move the chunks, then, add a gravity acceleration, (with vectors is VERY easy) and you are done for the movement, then, use a timer to erase the chunks after a while.
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Kurasiu
Posts: 4
Joined: Thu Dec 06, 2012 4:48 pm

Re: Spawning/moving object chunks at explosion

Post by Kurasiu »

Sorry for the bump, however after re-reading irrlicht documentation I found three very useful (for this problem) methods in scene manager: createRotationAnimator, createDeleteAnimator and createFlyCircleAnimator. Rotation Animator and delete animator are working flawless, I'm having no problems with spawning chunks, rotating them and deleting after 3 seconds.

However I'm fiddling around with values in fly circle animator and I can't quite get it to move along a nice circle/arch-part of the circle, like on the GIF above. Anybody did this already, any tips?
Abraxas)
Posts: 227
Joined: Sun Oct 18, 2009 7:24 am

Re: Spawning/moving object chunks at explosion

Post by Abraxas) »

All the animator is doing is changing it's position and rotation. It's really worth it to learn to array things and manage them yourself.
Kurasiu
Posts: 4
Joined: Thu Dec 06, 2012 4:48 pm

Re: Spawning/moving object chunks at explosion

Post by Kurasiu »

Abraxas) wrote:All the animator is doing is changing it's position and rotation.
Wow, you don't say! Well, if you haven't noticed yet that's exactly the thing I'm trying to do. No fancy things, no physics, no ballistic equation, just changing the position and rotation of the chunk.
Post Reply