[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4787: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4789: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4790: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4791: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
InsideQC Forums • View topic - making particles collide and bounce in stock quake

making particles collide and bounce in stock quake

Discuss programming topics for the various GPL'd game engine sources.

Moderator: InsideQC Admins

making particles collide and bounce in stock quake

Postby leileilol » Thu Mar 19, 2009 9:17 am

HI!!!!

i'm messing about the "QUACK ENEGN PROGRAMING" and I wanted to make particles not go THROUGH WALLS specifically on rocket particles.

and I also want to make rocket sparks bounce too!!

HOW DO THIS! I tried to steal the TOMAZ QUAKE CODE but its like a completely different particle system dependent on contents and so that doesn't really plug into winquake as well as i'd like


I DO NOT WANT TO REPLACE THE WHOLE PARTICLE SYSTEM!!!

also after this i plan to have a silly hack to 'decal' the particle to live 5x longer and flatten itself to the surface it touched. I dreamed of doing this in 2000 but never ever attempted this because I never got the former working. I would then go ape with blood particles that splatter all over the place and don't break sweats on entity counts because there are none. i'd have no idea to rasterize 'decal particles' in software, maybe by a oriented colored sprite block or so.
leileilol
 
Posts: 2783
Joined: Fri Oct 15, 2004 3:23 am

Postby Tomaz » Thu Mar 19, 2009 3:39 pm

I dont see why adopting the system i used to WinQuake wouldnt work? WinQuake doesnt use contents? Its not like thats a renderer specific thing.

If I remember I'll look it up when I get home from work.
Tomaz
 
Posts: 67
Joined: Fri Nov 05, 2004 8:21 pm

Postby mh » Thu Mar 19, 2009 4:44 pm

Easiest way is probably to do a Mod_PointInLeaf (p->org, cl.worldmodel) for each particle, check the contents of the returned leaf, and if it's CONTENTS_SOLID assume that it's gone into a wall and set p->die = -1 and skip drawing it.

A crude way to make them bounce would then be to set p->vel[0] = -p->vel[0], and etc for [1] and [2] if it hit's solid.

Should be fine for any Quake, Win or GL, as the data required is available.

This won't work with brush model entities however, so particles will go through doors and plats. Also, a particle can still go through a wall if it moves fast enough (it would have to be really fast, and with a low framerate, though).

Better ways would be more computationally intensive.
Last edited by mh on Thu Mar 19, 2009 4:46 pm, edited 1 time in total.
User avatar
mh
 
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Postby Spike » Thu Mar 19, 2009 4:45 pm

qboolean SV_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, vec3_t p1, vec3_t p2, trace_t *trace);

so:

{
trace_t tr;
vec3_t endpos;

memset(&tr, 0, sizeof(tr));
tr.fraction = 1;
VectorMA(p->origin, frametime, p->vel, endpos);
VectorCopy(endpos, tr.endpos);
SV_RecursiveHullCheck(&cl.worldmodel->hulls[0], 0, 0, 1, p->origin, endpos, &tr);
VectorCopy(tr.endpos, p->origin);
if (tr.fraction != 1)
{
float f = DotProduct(vel*tr.plane_normal)*-2;//bounce like a super-bouncy ball.
VectorMA(p->vel, f, tr.plane_normal, p->vel);
}
}


Insert the above code instead of the following line:
VectorMA(p->origin, frametime, p->vel, p->origin);

Then it'll clip particles to the world.

notes:

sv_recursivehullcheck is a generic function provided inside the server code. the 0,0,1 parameters are needed due to its recursive nature, but should be set as above for starting at the top of the bsp tree.
the passed in trace_t structure needs to be pre-initialised. Really its only the values you want set if it should fail to hit anything. This being fraction, solidity, and endpos.
If the trace starts solid, endpos will not be changed. This means the particle will pass through solids still, but only if the trace started in a solid. This gives some protection against moving BSP objects.
hull 0 is the point-sized/infinity-small hull. The next smallest is too big.

It'll not clip to doors/moving plats/func_wall.
For that you'd need to iterate over the visentities list for bsp models, and pick whichever trace gave the smallest fractions.
CL_LinkEntities will give you hits here, but I'm not gonna discuss it in detail cos I don't remember the contents of that array or even the actual name of it.

The above code will probably not even compile. Certainly it'll have undeclared functions.


Regarding oriented decals... Which texture are you going to use? :)
.
Spike
 
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Postby LordHavoc » Thu Mar 19, 2009 7:17 pm

I used to keep the cl_particles.c in DP compileable in glquake engines, but I stopped maintaining the compatibility, it could be added back if you want to drop in the DP particle system...
LordHavoc
 
Posts: 322
Joined: Fri Nov 05, 2004 3:12 am
Location: western Oregon, USA

Postby MeTcHsteekle » Tue Mar 24, 2009 9:31 pm

bah
MeTcHsteekle
 
Posts: 399
Joined: Thu May 15, 2008 10:46 pm
Location: its a secret

Postby LordHavoc » Wed Mar 25, 2009 5:14 am

LordHavoc
 
Posts: 322
Joined: Fri Nov 05, 2004 3:12 am
Location: western Oregon, USA


Return to Engine Programming

Who is online

Users browsing this forum: No registered users and 2 guests