# 3D Explosion

**URL:** <https://forum.kirupa.com/t/3d-explosion/258053>\
**Category:** Uncategorized\
**Created:** [April 20, 2008, 11:14am UTC](https://forum.kirupa.com/t/3d-explosion/258053 "2008-04-20T11:14:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![substance](https://avatars.discourse-cdn.com/v4/letter/s/c6cbf5/32.png) [@substance](https://forum.kirupa.com/u/substance)\
**Post date:** [April 20, 2008, 11:14am UTC](https://forum.kirupa.com/t/3d-explosion/258053/1 "2008-04-20T11:14:40Z")

</div>

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](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 :

```php
var scaleRatio = FocalLength/(FocalLength + Objects*.positionz);
//add velocity to Z position
Objects*.positionz += Objects*.velocityz; 
//Render
Objects*.scaleX = scaleRatio;
Objects*.scaleY = scaleRatio;

```

I can upload the whole class file if needed.
