substance
April 20th, 2008, 07:14 AM
I was messing around with making a particle system and I managed to come up with something that worked well to make a good explosion. I wanted to go a step further and make the explosion have the illusion of being 3d (having piecies fly at you etc.) But I'm a bit stumped with created fake 3D in flash. I found a few old AS2 tutorials but none seemed work when porting over.
Here's what I got : http://img242.imageshack.us/my.php?image=explosionmi0.swf (click to make explosions)
I basically create a random Z velocity and base scale off that Z position. It seems like the scale is working fine, but as you can see, something is bit off. I'm guess it's because I dont change the X and Y coordinates based on scale. I saw a few examples on how to do this but when applying that technique I always get wacky results. Here's (http://www.kirupa.com/forum/attachment.php?attachmentid=26097&d=1120671767) a better example of how a 3d explosion should look.
Lastly, here's a glipse of what I'm doing :
var scaleRatio = FocalLength/(FocalLength + Objects[i].positionz);
//add velocity to Z position
Objects[i].positionz += Objects[i].velocityz;
//Render
Objects[i].scaleX = scaleRatio;
Objects[i].scaleY = scaleRatio;
I can upload the whole class file if needed.
Here's what I got : http://img242.imageshack.us/my.php?image=explosionmi0.swf (click to make explosions)
I basically create a random Z velocity and base scale off that Z position. It seems like the scale is working fine, but as you can see, something is bit off. I'm guess it's because I dont change the X and Y coordinates based on scale. I saw a few examples on how to do this but when applying that technique I always get wacky results. Here's (http://www.kirupa.com/forum/attachment.php?attachmentid=26097&d=1120671767) a better example of how a 3d explosion should look.
Lastly, here's a glipse of what I'm doing :
var scaleRatio = FocalLength/(FocalLength + Objects[i].positionz);
//add velocity to Z position
Objects[i].positionz += Objects[i].velocityz;
//Render
Objects[i].scaleX = scaleRatio;
Objects[i].scaleY = scaleRatio;
I can upload the whole class file if needed.