Jump to content

Arrow Trajectories


Recommended Posts

I'd just like to make a humble suggestion that arrows and javelins should arc more when launched.  I won't make any claim regarding the angle archers historically used, but in general, I prefer that aesthetic since the projectiles are easier to see, and they do not clip through as many buildings and units, breaking the visual immersion.  

  • Like 2
Link to comment
Share on other sites

@Thorfinn the Shallow Minded I agree completely. The projectiles are very hard to see.

 

@Stan` @Freagarach @Angen

Is 
        <Gravity>9.81</Gravity>

where the visual "arc" of the projectile comes from? I know there's a relationship with the arc and projectile speed as well.

Edited by wowgetoffyourcellphone
Link to comment
Share on other sites

Just now, Thorfinn the Shallow Minded said:

The other approach would be altering the arrow's initial velocity.  At maximum range, when not accounting for differences in elevation with the target, archers should always use a 45 degree angle.  This angle can change as the target gets closer.

DE reduces projectile speed considerably over the base game's projectile speed. Maybe check that out and see if it looks better to you.

Link to comment
Share on other sites

 

4 hours ago, wowgetoffyourcellphone said:

DE reduces projectile speed considerably over the base game's projectile speed. Maybe check that out and see if it looks better to you.

I checked out some footage; definitely it's more on the visible side of things.  Could you give a numerical comparison of what percentage of a difference in speed Delenda Est has?

Link to comment
Share on other sites

The use of 9.81 for <gravity> in vanilla Zero AD is inappropriate because the in-game unit-models are depicted at about a 2:1 scale. (I.e. human units are drawn as being approximately 4 meters tall in-game!) Therefore, a gravitational acceleration of 9.81 m/s^2 at 2:1 scale works out as only 4.905 m/s^s relative to the human characters on screen. A more appropriate quantity would be 19.62, but since the scaling factor is just a very imprecise approximation anyway (personally) I would just put it at a nice round 20.0.

Link to comment
Share on other sites

53 minutes ago, ChronA said:

The use of 9.81 for <gravity> in vanilla Zero AD is inappropriate because the in-game unit-models are depicted at about a 2:1 scale. (I.e. human units are drawn as being approximately 4 meters tall in-game!) Therefore, a gravitational acceleration of 9.81 m/s^2 at 2:1 scale works out as only 4.905 m/s^s relative to the human characters on screen. A more appropriate quantity would be 19.62, but since the scaling factor is just a very imprecise approximation anyway (personally) I would just put it at a nice round 20.0.

The scale of the units is 2 meters

Link to comment
Share on other sites

49 minutes ago, Trinketos said:

The scale of the units is 2 meters

I think you need to do a quick experiment as a sanity check (I know I did). Place two non allied Mauryan spear infantry. Observe that their spears are about the same height as them (2 meters). Now have them fight, and observe that their spears only just touch each other with the butt conveniently right near the center of the attacking model. Thus the separation of the two units must be 2 meters (call it 2.5 or even 3 since the target's  body has some thickness and he is leaning forward). Now check the xml and you will find that the spearman's range is set at 4.5 game meters. What happened to the extra 1.5 to 2 meters?

Also observe that the footprint of the spearman is is set as a circle with radius 1.5 meters, meaning it should have a diameter of 3 meters. However the spearman is visibly much taller than the circle is wide, meaning his height is at least 3 meters.

I assumed this was a deliberate decision on the part of the dev team. If it is not then you have some major revisions to do. (And please don't tell me melee and footprints use different distance units from range attacks, because that would be insanity and I would need to uninstall 0AD on principle.)

Link to comment
Share on other sites

4 minutes ago, ChronA said:

I think you need to do a quick experiment as a sanity check (I know I did). Place two non allied Mauryan spear infantry. Observe that their spears are about the same height as them (2 meters). Now have them fight, and observe that their spears only just touch each other with the butt conveniently right near the center of the attacking model. Thus the separation of the two units must be 2 meters (call it 2.5 or even 3 since the target's  body has some thickness and he is leaning forward). Now check the xml and you will find that the spearman's range is set at 4.5 game meters. What happened to the extra 1.5 to 2 meters?

Also observe that the footprint of the spearman is is set as a circle with radius 1.5 meters, meaning it should have a diameter of 3 meters. However the spearman is visibly much taller than the circle is wide, meaning his height is at least 3 meters.

I assumed this was a deliberate decision on the part of the dev team. If it is not then you have some major revisions to do. (And please don't tell me melee and footprints use different distance units from range attacks, because that would be insanity and I would need to uninstall 0AD on principle.)

This is all true, but "meters" as far as the code goes is just an arbitrary unit of measurement, really. The programmer have called them "cubits" or "yards" or "rods" or anything really.

Link to comment
Share on other sites

Yes, someone did increase the base game's gravity to 39.81 for most ranged units. Slingers a little less, which I agree with too. So, arrows will definitely look a lot better for A24 @Thorfinn the Shallow Minded. I've done the same for DE as well. The arching projectiles are a ton easier to see than before. (y) 

Edited by wowgetoffyourcellphone
Link to comment
Share on other sites

25 minutes ago, wowgetoffyourcellphone said:

This is all true, but "meters" as far as the code goes is just an arbitrary unit of measurement, really. The programmer have called them "cubits" or "yards" or "rods" or anything really.

Precisely.:) So what I was trying to say is that I think (based on the scale of the units) the strength of gravity in 0AD ought to be about 20 units/s^2, in order to better match our local gravity of 9.81 m/s^2. I'm very glad to hear that the core development team concur and the issue will be improved in the next version.

40.0 units/s^2 sounds fine to me even if it is unrealistically strong for the size of the units. Exaggeration is key to good animation after all. 

Link to comment
Share on other sites

While in reality gravity is indeed an acceleration (i.e. distance divided by time square), 0 A.D. doesn't have real world physics, and <Gravity> is just a number.

@LordGood did change it last year for many templates: https://trac.wildfiregames.com/changeset/23144 However, the new values are a bit arbitrary; e.g. archers and towers have a <Speed> of 75.0 and a <Gravity> of 39.81; javelineers have a lower <Speed>, but the same <Gravity>; other structures (civic centre, fortress, army camp) have the same <Speed>, but a <Gravity> of only 9.81; bolt-shooters have the highest <Speed> in game, 150.0, and the lowest <Gravity>, 9.81.

Mods can experiment with what values would produce good-looking trajectories. If there is consensus for a particular ratio (e.g. 2:1), then a patch can be made to standardize the values in 0 A.D.

And maybe the <Speed> ought to be related to the <MaxRange>.

Edited by Nescio
<Gravity>
Link to comment
Share on other sites

10 hours ago, Nescio said:

And maybe the <Speed> ought to be related to the <MaxRange>.

If we ignore aerodynamics and if I didn't screw up my math "<range> = <speed>2 * sin(2 * elevation) / <gravity>" for even terrain.

 

I wonder how this whole arced trajectories can be reasonably done so the unit animations matches the required elevations.

Link to comment
Share on other sites

This is calculation of position at time t for projectile:

CVector3D position(float t)

{

float t2 = t;

if (t2 > timeHit)

t2 = timeHit + logf(1.f + t2 - timeHit);

CVector3D ret(origin);

ret.X += v.X * t2;

ret.Z += v.Z * t2;

ret.Y += v.Y * t2 - 0.5f * gravity * t * t;

return ret;

}

Where v.y is 

v.Y = offset.Y / timeHit + 0.5f * gravity * timeHit;

Link to comment
Share on other sites

On 8/30/2020 at 10:42 PM, ChronA said:

I think you need to do a quick experiment as a sanity check (I know I did). Place two non allied Mauryan spear infantry. Observe that their spears are about the same height as them (2 meters). Now have them fight, and observe that their spears only just touch each other with the butt conveniently right near the center of the attacking model. Thus the separation of the two units must be 2 meters (call it 2.5 or even 3 since the target's  body has some thickness and he is leaning forward). Now check the xml and you will find that the spearman's range is set at 4.5 game meters. What happened to the extra 1.5 to 2 meters?

Also observe that the footprint of the spearman is is set as a circle with radius 1.5 meters, meaning it should have a diameter of 3 meters. However the spearman is visibly much taller than the circle is wide, meaning his height is at least 3 meters.

I assumed this was a deliberate decision on the part of the dev team. If it is not then you have some major revisions to do. (And please don't tell me melee and footprints use different distance units from range attacks, because that would be insanity and I would need to uninstall 0AD on principle.)

In blender the units have 2 mts tall.

  • Like 1
Link to comment
Share on other sites

6 hours ago, Trinketos said:

In blender the units have 2 mts tall.

No, you're mistaken, they're actually slightly over 4 m tall in Blender:

On 5/19/2020 at 7:59 PM, Stan` said:

image.png

Notice the Z axis (height)

For comparison, the default cube with position 0,0,0 and scale 1,1,1 has dimensions 2×2×2.

  • Like 2
Link to comment
Share on other sites

On 9/3/2020 at 7:20 PM, Nescio said:

No, you're mistaken, they're actually slightly over 4 m tall in Blender:

For comparison, the default cube with position 0,0,0 and scale 1,1,1 has dimensions 2×2×2.

Hey, I noticed that when arrows impact a unit, they kind of look like they are disappearing into the air. Is this because the units are too wide? Could their actor width be decreased and possibly ranged unit spread decrease to compensate? It would look more realistic.

Edited by myou5e
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...