How to make a ballistic weapon arc just a little
Moderator: Moderators
How to make a ballistic weapon arc just a little
Hijacking: How to make a ballistic weapon arc just a little, i only saw the "hightrajectory" tag (which has a ridiculus arc height)?
Re: How to make a ballistic weapon arc just a little
Don't hijack threads. You're allowed to make your own.
Re: How to make a ballistic weapon arc just a little
Play around with gravityAffected = true and various myGravity = x settings, as well as the velocity of the weapon.
-
- Moderator
- Posts: 2464
- Joined: 12 Oct 2007, 09:24
Re: How to make a ballistic weapon arc just a little
For a Cannon make the weaponVelocity high or myGravity low.
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: How to make a ballistic weapon arc just a little
FixedGoogle_Frog wrote:For a Cannon make the weaponVelocity low or myGravity high.

-
- Moderator
- Posts: 2464
- Joined: 12 Oct 2007, 09:24
Re: How to make a ballistic weapon arc just a little
From my understanding he wants it to arc "just a little" not a lot, as in a mostly flat trajectory. Your fixes are wrong forb.
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: How to make a ballistic weapon arc just a little
If your ballistic shot is so fast that the trajectory is flat, you slow down the projectile and it will start being fired in an arc. OR You increase gravity on the projectile so that the unit must aim higher to get more distance. My fixes are very right.
Re: How to make a ballistic weapon arc just a little
a problem i encountered with this is that the procetile isn't fired at the maximum range and also has problems with targeting higher terrain.
What i want would be: behaviour similar to "hightrajectory" aka fire in the air with at least 45 degrees angular but without the shot going to the moon and back.
Perhaps the missile weapontype is more usefull for that?
What i want would be: behaviour similar to "hightrajectory" aka fire in the air with at least 45 degrees angular but without the shot going to the moon and back.
Perhaps the missile weapontype is more usefull for that?
Re: How to make a ballistic weapon arc just a little
imo yes, it has the TrajectoryHeight tag.Erik wrote:Perhaps the missile weapontype is more usefull for that?
ie TrajectoryHeight = 2.5
->arc is 2.5 times as high as long
usually needs turnrate to hit though.
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: How to make a ballistic weapon arc just a little
Yeah knorke is right. Achieving that kind of angle and still getting maximum range on a cannon weapontype is very difficult if not outright impossible. In this way, missiles are a lot easier to get along with.
-
- Moderator
- Posts: 2464
- Joined: 12 Oct 2007, 09:24
Re: How to make a ballistic weapon arc just a little
This appears to be a misunderstanding stemming from the colloquial phrase 'just a little'. I interpret it that he wants a reduction of value; 'just a little, not a lot'. Whereas you interpreted it as 'just a little more than the current nothing'.Forboding Angel wrote:If your ballistic shot is so fast that the trajectory is flat, you slow down the projectile and it will start being fired in an arc. OR You increase gravity on the projectile so that the unit must aim higher to get more distance. My fixes are very right.
Using a missile is not a good solution. A missile will not look like a ballistic projectile, the arc and velocity is not quite the same, it doesn't gain or lose ranged based on height in the same way (I know this one can be modified, but it wouldn't look balistic).
A 45 degree firing is easy but a bit tedious. Set myGravity on the weapon to something around 0.1-0.2 depending on weaponVelocity and range. Here is an example:
- range = 820
- weaponVelocity = 300
- myGravity = 0.11
Then execute this algorithm:
Code: Select all
While (not fedUp)
if actualRange < range then
decrease myGravity
if angle < 45 degrees then
increase myGravity
restart Spring
end while
angle can be measured by 'eyeing-off' the projectile as your unit fires, scroll down to look at it side on.
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: How to make a ballistic weapon arc just a little
45 degrees isn't just a little. It's quite a bit. But as I originally stated. You would achieve it by increasing gravity or decreasing velocity.
Google, I dunno when the last time you messed with ballistic projectiles was, but the synopsis is this: Lower velocity = more arc (come on, this just makes sense... When you are throwing a baseball as far as you can you don't throw it flat, you arc it so you get more distance, it works the same way in spring).
Increasing gravity is similar to lowering velocity (in effect, you actually are lowering velocity... in a way). But that's all retarded theory of BS bla bla. If you want a faster projectile, then increase velocity and gravity and you will have your arc with a fast moving projectile. The inverse applies, etc etc.
Google, I dunno when the last time you messed with ballistic projectiles was, but the synopsis is this: Lower velocity = more arc (come on, this just makes sense... When you are throwing a baseball as far as you can you don't throw it flat, you arc it so you get more distance, it works the same way in spring).
Increasing gravity is similar to lowering velocity (in effect, you actually are lowering velocity... in a way). But that's all retarded theory of BS bla bla. If you want a faster projectile, then increase velocity and gravity and you will have your arc with a fast moving projectile. The inverse applies, etc etc.
-
- Moderator
- Posts: 2464
- Joined: 12 Oct 2007, 09:24
Re: How to make a ballistic weapon arc just a little
Google_Frog wrote:This appears to be a misunderstanding stemming from the colloquial phrase 'just a little'. I interpret it that he wants a reduction of value; 'just a little, not a lot'. Whereas you interpreted it as 'just a little more than the current nothing'.Forboding Angel wrote:If your ballistic shot is so fast that the trajectory is flat, you slow down the projectile and it will start being fired in an arc. OR You increase gravity on the projectile so that the unit must aim higher to get more distance. My fixes are very right.
Re: How to make a ballistic weapon arc just a little
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
Re: How to make a ballistic weapon arc just a little
Game.gravity?FLOZi wrote:GRAVITY = 120
or does that not work in _post file?
missile/ballistic depends on what you need.
if you just want a slight arc so that tanks can fire over each other when in close formation, I found missiles easier to use.
Re: How to make a ballistic weapon arc just a little
Bingo, not available at defs loading stage.knorke wrote:Game.gravity?FLOZi wrote:GRAVITY = 120
or does that not work in _post file?.
Re: How to make a ballistic weapon arc just a little
Just force it with myGravity, keeps maps from fucking with your balancing.
Anyway, cannons in Spring are simulated according to physics and since the bullets are fired at a fixed speed the angle varies according to the target distance. If you want a hightrajectory shot to stay low then slow the projectile down. If that decreases the range then you are asking the impossible from your gun, that it shoots a bullet further than physically possible given the velocity it's fired at. Many games cheat and vary gravity or something to make their shots arc at 45┬░ at any range but Spring isn't designed for that nonsense.
Anyway, cannons in Spring are simulated according to physics and since the bullets are fired at a fixed speed the angle varies according to the target distance. If you want a hightrajectory shot to stay low then slow the projectile down. If that decreases the range then you are asking the impossible from your gun, that it shoots a bullet further than physically possible given the velocity it's fired at. Many games cheat and vary gravity or something to make their shots arc at 45┬░ at any range but Spring isn't designed for that nonsense.
- KingRaptor
- Zero-K Developer
- Posts: 838
- Joined: 14 Mar 2007, 03:44
Re: How to make a ballistic weapon arc just a little
Old page by Evil4Zerggin, dunno if it's still accurate.
Weaponvelocity and Range
If a weapon with a ballistic trajectory does not have enough weaponvelocity, it will not be able to hit its listed range.
To hit a target at the same level as the firer, the required weaponvelocity is given as follows:
v >= sqrt(gR)
where v is the weaponvelocity, R is the desired maximum range, and g is the map gravity. If the target is directly above the firer, this becomes
v >= sqrt(2gR)
Map gravity rarely exceeds 150 or so, and most firing points are elevated above surface level, so 150 is generally a good minimum value to use for g.
Weaponvelocity and Firing Angle
More generally speaking, if the firing angle is a, the angle needed to hit a target at the same level as the firer is given by
a = arcsin(gr/v^2)/2
where r is the distance to the target. From this, the following will cause the firing angle to differ more from 45 degrees:
- Low map gravity.
- A close target.
- High weaponvelocity.
Re: How to make a ballistic weapon arc just a little
Nicely done.KDR_11k wrote:Just force it with myGravity, keeps maps from fucking with your balancing.
Anyway, cannons in Spring are simulated according to physics and since the bullets are fired at a fixed speed the angle varies according to the target distance. If you want a hightrajectory shot to stay low then slow the projectile down. If that decreases the range then you are asking the impossible from your gun, that it shoots a bullet further than physically possible given the velocity it's fired at. Many games cheat and vary gravity or something to make their shots arc at 45┬░ at any range but Spring isn't designed for that nonsense.
In second thought, if a high powered ballistic weapon fired at its maximum or limit distance that would probably do a curve trajectory on it bullet,right?
Vindicator wrote:Field target cross bows are usually hand-made, often home-made by their users.
Last edited by SirDario on 21 Feb 2012, 08:53, edited 1 time in total.
-
- Moderator
- Posts: 2464
- Joined: 12 Oct 2007, 09:24
Re: How to make a ballistic weapon arc just a little
Idk exactly what you mean so I'll just say a few broad things. Some may be relevant.
A weapon cannot shoot further than it's range. The physical properties (velocity, gravity etc...) have no effect on this fact.
More distance fired = greater fire pitch. Weapon velocity is unchanged, pitch is used to aim between distances.
Projectiles with gravity always curve.
A weapon cannot shoot further than it's range. The physical properties (velocity, gravity etc...) have no effect on this fact.
More distance fired = greater fire pitch. Weapon velocity is unchanged, pitch is used to aim between distances.
Projectiles with gravity always curve.