PDA

View Full Version : What is the falling of projectiles governed by?


sroerick
02-19-2004, 11:40 PM
E.G repeater alternate fire. Where would you change how fast it falls?

Codja X
04-18-2004, 09:14 AM
Gravity.

Seriously - there's a gravity cvar that is set by default to 800, so if you change it, you can change the trajectory of it. This would affect other weapons as well and projectiles such as the grenades etc.

My 1st post in the coding forum - hope it helps someone:)

Jon Denver
04-18-2004, 09:54 AM
I would think that every entity has a 'weight', at least that would make sense... :confused:

Codja X
04-18-2004, 11:31 AM
I'm pretty sure the cvar is sv_gravity. Type it in the console - the lower the number specified, the lower the gravity. You could probably set this in the .cfg per map and wouldn't need coding or compiling.

Wudan
04-19-2004, 02:20 PM
Yes, but changing the cvar affects everything.

The code for the behavior of this projectile is in g_weapon.c, the function is "static void WP_RepeaterAltFire( gentity_t *ent )", it's at line 1074.

To make it descend slower, just alter the line:

missile->s.pos.trDelta[2] += 40.0f; //give a slight boost in the upward direction

as you see fit. What i'd do is make a server side cvar, tie it to missile->s.pos.trDelta[2] and then play with the setting to get it where you want it.