Skip to main content
GameDev.net gamedev.net
🔒 Locked

Non hard coded particle effects

Started by Theriomorph Mar 26, 2004 at 12:44 AM 2 replies 700+ views
Original Post
Theriomorph
Theriomorph
I''m trying to make a particle engine as a little challenge for myself but i''ve come across something that I can''t quite figure out. What I want to do is make a ''deflector'' (an invisible plane) that well, deflects particles when they come into contact with it. My problem is that I can''t figure out how to do this without hard coding it. eg. As a little test I said if the particles Y position is less than 0 then sit still. This simulates an infinite floor... Could anyone point me in the direction of a tutorial or theory or *anything* that would help me to be able to create deflectors without hard coding them into the engine? ie. Load them from a file at startup.
ph0ngwh0ng
ph0ngwh0ng
Basically, you would want to look into scripting languages and/or API, like LUA. Google for it

ph0ng^_^wh0ng
ph0ng^_^wh0ng
hplus0603
hplus0603
If you support an arbitrary plane for reflection (not just "y >= YY") hard-coded, then that''s step 1. Typically, you do this by sending in a normal vector, and comparing to some constant:


if( dot3( myParticle.pos, plane.normal ) < plane.constant ) {
hit the floor
}


To make this data driven, all you have to do is figure out a way to make "plane.normal" and "plane.constant" be read from some data file, instead of hard-coded. That text file probably also defines angles of particle emission, what texture(s) to use, etc.
enum Bool { True, False, FileNotFound };

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.