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:
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.
Spawning/moving object chunks at explosion
Re: Spawning/moving object chunks at explosion
I think you need to use triangle mesh ?
Re: Spawning/moving object chunks at explosion
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
Re: Spawning/moving object chunks at explosion
Do a forum search for "destruction in irrlicht" I answered this question a couple days ago
Re: Spawning/moving object chunks at explosion
Ok, to sum it up, I'm using
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. And I'm not working with the modeler who did the models for this game anymore.
Code: Select all
m_pChunk=vector3df(last_x, last_y, last_z);
m_pChunk->setPosition(m_pAnimatedMeshPosition);
Re: Spawning/moving object chunks at explosion
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
Re: Spawning/moving object chunks at explosion
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?
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?
Re: Spawning/moving object chunks at explosion
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.
Re: Spawning/moving object chunks at explosion
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.Abraxas) wrote:All the animator is doing is changing it's position and rotation.