Posted: Mon Sep 05, 2011 11:02 am Post subject:
Best Method for Debris on Explosions?
I don't need to be told how to spawn debris on an explosion. I'm well aware of that. However, when I used it, the debris doesn't spawn too uniformly, nor does it have a nice clean pattern to it. When the explosion hits, I want debris to fly outward from the center of the explosion in all directions in a more even fashion. Been trying for a while and I just can't seem to pin down any decent numbers... or if I'm even on the right track.
For you YR oldbies, I plan on doing something more with this than just spawning debris so using MinDebris/MaxDebris on the warhead is out.
The problem is that you spawn only 5 debris, but debris chose entirely random values from 1 to the specified MinZVel, MaxXYVel value.
Thus you only achieve a more even distribution by using more debris with each doing less damage.
A better, different approach for an even distribution with less debris, is to use a Cluster weapon, which plays the cluster explosion upon impact (no second stage projectile using airburst).
This creates all the cluster explosions with the same radius around the center explosion and with a high enough Cluster, you get some kind of circle in a 2,5 cell distance around the center explosion.
Another more complicated way, is to use intermediate steps for the debris. Though i'm not 100% sure if this really works that way. Needs to be tested.
1. Let a debris fly straight upwards using MinZVel=100, MaxXYVel=1
and give it only a limited lifetime without any loops with
Start=0
End=20
LoopCount=0
2. Use the Next key to then switch to a different animation. This way you have an animation fixed positioned high in mid-air.
3. Let this animation spawn the debris using TrailerAnim and give the debris MinZVel=1 and MaxXYVel=1. This way the debris can't choose random speeds in any xy direction and thus fly all the same distance.
With the initial debris MinZVel you can then define the height from where the debris are spawned and this way indirect the distance they fly.
e.g.
Code:
;this flies straight upwards
[EVENINIT]
Image=CLRANIM ;this is only an shp with clear frames
ExpireAnim=none ;doesn't works in mid-air and only when debris hit the ground
Elasticity=0.0
MaxXYVel=1.0 ;don't fly much to the side
MinZVel=150.0 ;let it fly fast upwards
Bouncer=yes
Start=0
End=20 ;stop playing the debris in mid-air
LoopCount=0
Rate=300 ;use this to raise/lower the lifetime and thus the height at which it goes to the next animation
Next=EVENSPWN ;create an animation high in air
;this spawns the debris from a high position in mid-air
;Spawns= on EVENINIT doesn't works unfortunately, as it's only spawning debris when a debris hits the ground (at least in TS) but not when the anim/debris ends in mid-air
[EVENSPWN]
Image=CLRANIM
Start=0
End=10 ;amount of debris since every TrailerSeperation's frame one debris is spawned
Rate=900 ;use 25 frames per second measuring so the End key defines the exact amount of spawned debris
TrailerAnim=EVENDEBR
TrailerSeperation=1 ;spawn every frame a debris
[EVENDEBR]
Image=none ;this is only a dummy
ExpireAnim=TWLT100 ;the normal animation that should be played
Elasticity=0.0
MaxXYVel=1.0 ;no random xy speed
MinZVel=1.0
Bouncer=yes
I'll get the codes together for ya tomorrow, and you'll only need to change a couple things to tone it down to your liking.
and by looking at LKO codes, I dont see any reason for it not to work. But his way will have a different outcome than mine. Try them both and choose which one you like the best. Or better yet, use them both and make 2 seperate SW's _________________
The enemy shall be injected with toxic poison - Venom QUICK_EDIT
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum