How to make a ballistic weapon arc just a little - Page 2

How to make a ballistic weapon arc just a little

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: How to make a ballistic weapon arc just a little

Post by Forboding Angel »

Something not mentioned previously... If you want a weapon with fast velocity but an arc, you can do it pretty effectively with gravity. Problem is (unless I'm mistaken), the arc can get pretty jagged and unrealistic if you overdo it.
User avatar
Deadnight Warrior
Posts: 183
Joined: 08 Jun 2009, 17:59

Re: How to make a ballistic weapon arc just a little

Post by Deadnight Warrior »

FLOZi wrote:Getting ballistic weapons to fire exactly (well, so long as map gravity is ~120) at 45 degrees at their maximum range is easy btw.

Code: Select all

local GRAVITY = 120

for weapName in pairs(WeaponDefs) do 
	if WeaponDefs[weapName].customparams then
		if WeaponDefs[weapName].customparams.howitzer then
			WeaponDefs[weapName].weaponvelocity = math.sqrt(WeaponDefs[weapName].range * GRAVITY)
		end
	end
end
I use something simmilar for XTA but a bit more accurate formula

Code: Select all

local customGravity = 1.0
local velGravFactor = customGravity * 900
for id in pairs(WeaponDefs) do
	if WeaponDefs[id].weapontype == "Cannon" and WeaponDefs[id].range and not WeaponDefs[id].mygravity and not WeaponDefs[id].cylindertargetting then
		WeaponDefs[id].mygravity = customGravity
		WeaponDefs[id].weaponvelocity = math.sqrt(WeaponDefs[id].range * velGravFactor)
	end
end
You can fiddle with the customGravity variable to set the projectile speed. All affected weapons will fire at 45° when engaging at max range.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: How to make a ballistic weapon arc just a little

Post by knorke »

Forboding Angel wrote:If you want a weapon with fast velocity but an arc, you can do it pretty effectively with gravity. Problem is (unless I'm mistaken), the arc can get pretty jagged and unrealistic if you overdo it.
no, iirc the projectile does follow a smooth flightpath. Just the smoketrail=true effect looks jagged on tight turns.
Post Reply

Return to “Game Development”