You're probably talking about the Praxis effect
https://en.wikipedia.org/wiki/Praxis_effect
I'd simply create any number of particles at the center of the emitter, give them a random angle and move them accordingly, ignoring one axis so they move in a ring formation.
I don't have much experience with the AppGameKit 3D commands, but I wrote some code so you get the idea how it can be done.
This code isn't very flexible in its current state, but it's just to show the principle.
It features 1000 simple spheres exploding in a ring around a cube. Each sphere will change its alpha value during the explosion, and will be deleted after a specified lifetime.
You could also delete the spheres after alpha reaches a value of 0, or just check both. Really depends on what you're planning to do with it.
#option_explicit
#renderer "Basic"
SetErrorMode ( 2 )
#constant MAX 1000 // that's the total number of particles that can exist at any time
#constant LIFETIME 5000 // each particle lives for 5 seconds before it's killed
SetWindowSize ( GetMaxDeviceWidth(), GetMaxDeviceHeight(), 1 )
SetDisplayAspect ( GetMaxDeviceWidth() * 1.0 / GetMaxDeviceHeight() )
SetSyncRate ( 60, 1 )
// create emitter placeholder
global cube as integer
cube = CreateObjectBox ( 1, 1, 1 )
SetCameraPosition ( 1, 0, 10, -20 )
SetCameraLookAt ( 1, 0, 0, 0, 0 )
// particle
type ParticleType
ID as integer
x#, y#, z# as float // particle position
sx#, sy#, sz# as float // particle speed
alpha# as float
born as integer
endtype
global particle as ParticleType[MAX]
do
if GetRawKeyPressed ( 27 ) then END
if GetRawKeyPressed ( 32 ) then CreateExplosion()
MoveParticles()
print ( "Hit [SPACE] for Praxis effect" )
print ( "Hit [ESC] to quit" )
Sync()
loop
function CreateExplosion()
if GetObjectExists ( particle[1].ID ) then exitfunction
local i as integer
local angle# as float
for i=1 to MAX
// create particle
particle[i].ID = CreateObjectSphere ( .5, 4, 4 )
SetObjectColor ( particle[i].ID, 0, 100, 200, 255 )
SetObjectTransparency ( particle[i].ID, 1 )
// set position at the center of the emitter ( cube )
particle[i].x# = GetObjectX ( cube )
particle[i].y# = GetObjectY ( cube )
particle[i].z# = GetObjectZ ( cube )
// set angle and speed. We want a ring, so we ignore the y-axis
angle# = random ( 0, 3599 ) / 10.0
particle[i].sx# = cos ( angle# ) * .1
particle[i].sy# = 0.0 // not necessary in this case
particle[i].sz# = sin ( angle# ) * .1
// set alpha and remember point of time the particle was created
particle[i].alpha# = 255.0
particle[i].born = GetMilliseconds()
next i
endfunction
function MoveParticles()
local i as integer
for i=1 to MAX
if GetObjectExists ( particle[i].ID )
MoveObjectLocalX ( particle[i].ID, particle[i].sx# )
MoveObjectLocalY ( particle[i].ID, particle[i].sy# ) // not necessary in this case
MoveObjectLocalZ ( particle[i].ID, particle[i].sz# )
SetObjectAlpha ( particle[i].ID, GetObjectAlpha ( particle[i].ID ) - 1.0 ) // reduce alpha
if GetMilliseconds() - particle[i].born > LIFETIME then DeleteObject ( particle[i].ID ) // kill if particle has exceeded its lifetime
endif
next i
endfunction
PSY