Game Development Community

Gravity for projectiles?

by Danner Jones · in Torque Game Engine · 12/21/2003 (9:51 pm) · 1 replies

I was tweaking crossbow.cs (part of the starter.fps sample) in the server scripts area and I don't see the value of gravityMod having any affect on my projectile.

I can tweak muzzleVelocity and see that have an impact. If I set it lower than the default value 100, to say 25, I can see gravity IS being applied (you can see it at 100, but more noticable at 25).

I see the value gravityMod being used in projectile.cc in function Projectile::processTick to calculate the velocity but it doesn't appear to have any effect. However, if I hardcode a value such as "4.0" in place of mDataBlock->gravityMod it does have the desired affect.

I must be missing something, but can't seem to find it.

Thanks!
Nerseus

#1
12/27/2003 (9:19 am)
You might want to look at the Dynamic and Individualized Gravity mod ( http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=1723 )

Expanding on that resource you could introduce an individualized gravity constant for your projectiles.

Examining the projectile code, it looks like if the isBallistic field is not turned on, gravityMod is not read into the data block (packData/unpackData).

That should be turned on. In my copy of crossbow.cs it is:

isBallistic = true;
gravityMod = 0.80;

My only other suggestion would be to throw some debug statements in the processTick to see what kind of numbers are actually getting to that section of the code.

-Jerry