Special Aircraft Service

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2 3 4 ... 7   Go Down

Author Topic: An opportunity to reduce the threshold for layer forest cover collisions?  (Read 3281 times)

0 Members and 1 Guest are viewing this topic.

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 6010

We have all experienced the sudden shock of exploding upon contact with the 'layer cake' forest, that infamously deceiving object which is essentially invisible when presenting as edge-on from its own level. Take-offs when such a forest is not far from the runway end are particularly hazardous. In Gear.class is the following little bit of code:

Code: [Select]
        double d2 = Engine.cur.land.HQ_ForestHeightHere(flightmodel.Loc.x, flightmodel.Loc.y);
        if(d2 > 0.0D && flightmodel.Loc.z <= d1 + d2 && ((Aircraft)flightmodel.actor).isEnablePostEndAction(0.0D))
            ((Aircraft)flightmodel.actor).postEndAction(0.0D, Engine.actorLand(), 2, null);

It determines if the plane's location is at or below the top of the forest. We could alter the threshold if we wish. For instance, instead of the threshold set as d1 + d2, we could set d1 + d2/2. This would provide a 'buffer' of safety, where the plane could sink halfway down through the forest before being obliterated. To be not so aggressively slanted toward safety, the threshold could be d + d2 * 0.75, which would render the lower 3/4 as dangerous territory.  ;)
Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 6010

A test with the height threshold set to 1/2 the forest height. Here we see that I'm below the 2nd highest layer; the larger, lighter splotch in the foreground is the highest, and the fuselage is mostly hidden by a darker splotch at the next level down.

An advantage of this approach, from a visual standpoint, is that planes will not blow up at the instant of touching the very top of the canopy, but instead will plunge some distance down into it before exploding. Of course, there will be instances of planes skimming for a considerable distance through the upper canopy, and so the lowered threshold shouldn't be as significant as this factor of 2. A 3/4 height threshold might be better all round.

I'll leave my 1/2 height threshold in effect for a while yet, observing the situations that result.

Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 6010

So far I can say that the explosions look FAR better when coming from deeper down inside the forest. It looks so much more real to see a plane largely or fully disappear onto the canopy before the fireball emerges. Previously there was always an artificiality with the explosion commencing upon the slightest initial contact with the upper layer. Both the delay and the lower height of the fireball significantly contribute to realism.
Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)

Kopfdorfer

  • member
  • Offline Offline
  • Posts: 2157
  • PULVERIZER

It would be way cool to implement this along with a mod that produced
tree detritus ( leaves and branches ( and associated sound files ) exploding
from the area of contact !

Just an old man dreaming !

Kopfdorfer
Logged

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 6010

To eliminate, or at least minimize, the oddity of a plane skimming a long distance through the canopy, a check on the plane's vertical velocity could be incorporated. At low sink rates, where the plane is almost maintaining height, we want the height threshold to be nearer to the top of the canopy, in order that we not see it continue unmolested for a great distance when clearly below the forest top. At ever faster sink rates, the height threshold could be lowered ever farther, all the way down to ground level for a sink rate higher than some selected threshold.

For example, this line, which finds the forest height above land where the plane is,

  double d2 = Engine.cur.land.HQ_ForestHeightHere(flightmodel.Loc.x, flightmodel.Loc.y);

could have added immediately following (extremely simplified!)

  if -sinkRate <= d2
    d2 = d2 - sinkRate;
  else if -sinkRate > d2
    d2 = 0;

This would reduce the height threshold by 1m for every 1m of sink rate. If the sink rate is greater than the forest height, the forest height is set to zero (so that no negative heights can result for higher sink rates.)
Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 6010

To attempt to incorporate additional effects to represent tree detritus from an explosion, it would be necessary to not recalculate the forest height as zero, as my previous example would do for faster sink rates. A limit should be applied whereby some forest height is retained, perhaps as small as 1m, in order that the condition of the forest being responsible for destruction is established. From which a dedicated effect or effects could be invoked.
Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 6010

I've succeeded in assigning a dedicated effect for crashes into forest cover, and so I can make up an effect to simulate flying vegetation. This applies to the 'layer cake' forest type. I haven't looked into what might be involved when crashing into individual trees (which, of course, would require a collision box, which the auto-pop trees do not have.)
Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)

Kopfdorfer

  • member
  • Offline Offline
  • Posts: 2157
  • PULVERIZER

Really cool WX !
Logged

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 6010

Here's an implementation of two brand new effects, one for stripped branches and the other for leafy branches. Currently set to a length of just about 3m. They have differing parameters, such that the bare branches have less air resistance, to keep them from slowing down as quickly, and they rotate more quickly.

More fine tuning to do, but largely ready for prime time otherwise.

Note also how the fireball is more deeply embedded into the forest, instead of sitting on the top of the canopy as was heretofore the norm.

Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)

shardana

  • member
  • Offline Offline
  • Posts: 850

As always speechless...
Logged

raf1659

  • member
  • Offline Offline
  • Posts: 358

YESSSSsssss  ]wav[
Logged

Kopfdorfer

  • member
  • Offline Offline
  • Posts: 2157
  • PULVERIZER

WxTeck that effect looks freakin' awesome.
And if my flying maintains its usual trajectory that is how
many , many strafing runs will end up !

Kopfdorfer
Logged
Pages: [1] 2 3 4 ... 7   Go Up
 

Page created in 0.037 seconds with 24 queries.