Here is the example:
Rem Project: Fluids-Particles
Rem Created: Tuesday, February 28, 2012
Rem ***** Main Source File *****
// FLUIDS & PARTICLES
// Fluids and particles are created using the same process, they
// will behave more like one or the other depending on the properties
// you give them.
// RENDERING
// There are many ways you could render your particles depending on what effect you
// are after. How you setup your particles is seperated to how they are rendered to
// screen, at the moment there are commands to render your particles as objects.
// This may be the easiest way to render particles but perhaps not too efficient,
// more advanced rendering techniques may be added in the near future.
// If you have a particular shader you wish to use then get in touch and I will
// do my best to provide any functions you need to achieve this.
//-- Be sure to add "PhysX Constants.dba" to your solution.
sync on
sync rate 60
autocam off
position camera 0, 50, -300
point camera 0, 0, 0
hide light 0
set ambient light 50
`load image "Media/Smoke.jpg", 1
load image "C:\Program Files (x86)\The Game Creators\Dark Basic Pro Free\Dark Basic Pro\Projects\Get Out Alive\Media\Blood\Blood Particle\Blood Particle 3.png", 1
particleCount = 1500
// We will create some objects and sync them to our
// particles later, in the game loop.
for i = 1 to particleCount
make object plain i, 5, 5
set object light i, 1
texture object i, 1
`ghost object on i
disable object zwrite i
set object transparency i, 4
set object light i, 0
`hide object i // Need to hide if particle objects are first introduced using an emitter.
next i
DYN START
DYN SET GRAVITY 0, -19.8, 0
// If we want to pre-position our particles we can do the following,
// not needed if using emitters
remstart
v = make vector3(1)
DYN UTIL ARRAY VEC3 INIT particleCount
x = 0
z = 0
for i = 0 to particleCount - 1
x = rnd(100) - 50
y = rnd(50)
z = rnd(100) - 50
set vector3 1, x, y, z
DYN UTIL ARRAY VEC3 SET i, 1
next i
v = delete vector3(1)
remend
// Set to 0 if the particles should be persistant.
pLife# = 5
// Setting the last parameter to 1 will pre-position the particles using
// the random values we set above, set to 0 if not needed.
DYN MAKE FLUID 1, particleCount, pLife#, 5.0, NX_FF_ENABLED || NX_FF_VISUALIZATION, 1
`DYN MAKE FLUID 2, particleCount, pLife#, 5.0, NX_FF_ENABLED || NX_FF_VISUALIZATION, 1
// Create an emitter which will become responsible for creating particles
// once they become available.
v = Make Vector3(1)
v = Make Vector3 (2)
Set Vector3 1, 0, 0, 0
Set Vector3 2, -90, 0, 0
DYN FLUID MAKE EMITTER 1, 1, 1, pLife#, 1, 1, 2
` Set emitter rate here
`DYN EMITTER SET RATE 1, 0, 1000
DYN FLUID SET SIMULATION METHOD 1, 1 `NX_F_SPH // 1"
DYN FLUID SET SIMULATION METHOD 1, NX_FF_HARDWARE
DYN FLUID SET VISCOSITY 1, 150.0
DYN EMITTER SET RANDOM ANGLE 1, 0, 1.5 //radians
DYN SIMULATE
do
DYN FETCH RESULTS
DYN UPDATE
// So far, our particles are not coupled to
// any rendering technique. The following
// three commands will sync the particles
// to the objects we created earlier.
DYN FLUID SYNC OBJECTS 1, 1
`DYN FLUID SET EXTERNAL ACCELERATION 1, RND(10), RND(10), RND(10)
// Ghosted plains work best when kept facing the camera.
DYN FLUID SET OBJECTS TO CAMERA 1, 1, 0
// We also have the option to fade objects in/out.
DYN FLUID FADE OBJECTS 1, 1, pLife#, 1, 4
// We can scale the objects to add the effect of the smoke dispersing.
DYN SIMULATE
control camera using arrowkeys 0, 1, 1
sync
loop
DYN DELETE FLUID 1
DYN FETCH RESULTS
DYN STOP
Let me know if you can get anything by tweaking the emitter rate. I was unsuccessful.
Attached is an example. If found it is working properly with no timing adjustments. That is a bit puzzling considering that I wasn't able to get it to work properly without timing on my main project.
Edit: That just confirms it is something else. I'm looking into it. I think it must be something keeping the object from moving. I did set the damping and maybe if I undo that it might fix it.
Edit: I still can't quite figure out what it was. I'm running all sorts of test to figure it out. I do know it is a glitch in my code and not the timing now. I just have no clue why.
Thanks,
DigitalFury
Zombie Video Game!