Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Glue Particles to limbs

Author
Message
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 9th Aug 2011 15:44 Edited at: 9th Aug 2011 15:53
I've never used particles before. I have made a plain, and glued it to a limb, and now I want to texture the flame particles on the plain. This is the flame code that I got off here...



I made this plain...
make object plain 1010,50,50

rotate object 1010,90,0,0
glue object to limb 1010,Tank,9
I put it in a do loop

Pseudo code...
Do

texture object 1010,100 + whatever
Loop

I don't really get what particles are.. I can't seem to directly glue them to my tank limb.

baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 9th Aug 2011 17:03 Edited at: 9th Aug 2011 17:04
Think of particles as multiple planes / objects which are created, textured, moved and deleted using a system.

Normally you have an emitter object which gives us a position in space to create our objects.

When creating particles all you do is make an object at the position of the emitter, then each loop you go through your list of active particles and edit their position and / or texture and if they have gone past the end of their 'life' to delete them.

Some systems are available that deal with all this behind the scenes but you can create your own system by creating several functions or sub-routines:

1-Setup routine - which creates the arrays and variables required by the system
2-Create emitter function - to create a new emitter. I recommend you create a UDT which can store the variables for your emitter such as life (of particles), type (of emitter), active (whether the emitter is currently active)
3-Update particles function - to create particles as and when they are due to be created. I recommend another UDT for particles which stores life (for this individual particle), type (of particle) and possibly the current image number
4-Kill emitter function - to delete an emitter

Just some suggestions in an attempt to make it clear how particles work.

There are lots of systems out there but I like making my own, you have more control

Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 9th Aug 2011 18:00
Ok I just made one in my do loop instead, I won't need them very often I don't think. Looks Ok anyway.

Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 9th Aug 2011 18:38
Most of the time a particle would be placed wherever you need it, then orientated to the camera, so the particle can move, fade out, change texture.

For example, if you made 10 particle objects and placed a different one at the turret each loop, meanwhile moving the particles up and fading them out. Then the particles would be more volumetric, they would trail with the turret movement, so you can do cool fire effects, smoke etc. Also, with explosions you can place several in one place and have them move out and fade, giving more unique explosions.

Making your own particle system is always worth doing, it can really make a difference - the work involved is very straightforward if you plan it out. Like, maybe the particles have a life cycle, which can be used to kill dead particles, fade them out. Also, the particle might have X Y and Z velocity. You could add a mode for the particle, then an update function to move and fade the particles each loop. It's easy to get carried away once the basic framework is in place, I've used particle systems for some crazy stuff, like moths that swarm around light sources, little fish, skeletons (using limb locations). I find that adding a particle effect is more fun than just about anything coding related - it's good to have something visual and fun to add to break up the drudgery.

Health, Ammo, and bacon and eggs!

Login to post a reply

Server time is: 2026-07-10 10:20:27
Your offset time is: 2026-07-10 10:20:27