Page 2 of 2

Re: [ZScript] Destructible geometry material handler

PostPosted: Mon Apr 06, 2020 2:24 am
by Jaska
For some unknown reason l.args[i] and l.special return 0 on every iteration. Sector index and lineindexes are correct.

Spoiler:

Re: [ZScript] Destructible geometry material handler

PostPosted: Mon Apr 06, 2020 2:57 pm
by dodopod
Okay, I didn't realize it, but Sector_Set3DFloor specials get erased, after the level loads. The good news is that it's actually much easier to do what you're trying to do than I originally thought. Try this:

Code: Select allExpand view
override void Material3DDestroyed(WorldEvent e)
{
    // I was wrong about how to calculate the pos before
    // z should be in the center of the control sector
    Vector3 pos;
    pos.z = e.damageSector.floorPlane.ZAtPoint(e.damageSector.centerSpot);
    pos.z += e.damageSector.ceilingPlane.ZAtPoint(e.damageSector.centerSpot);
    pos.z /= 2
   
    Super.Material3DDestroyed(e);   // calls MoveFloor/MoveCeiling

    for (int i = 0; i < e.damageSector.GetAttachedCount(); ++i)
    {
        Sector s = e.damageSector.GetAttached(i);

        // x & y should be in the center of the attached sector
        pos.xy = s.centerSpot;
        EjectDebris(8, "WOODGIB", pos, 32);   //Alternate debris, use this WoodenBit
    }
}

Re: [ZScript] Destructible geometry material handler

PostPosted: Tue Apr 07, 2020 12:30 am
by Jaska
Thanks dodopod! That's a nice looking solution there. Have to try that brick- thing later. Otherwise my mapping won't progress at all.

Re: [ZScript] Destructible geometry material handler

PostPosted: Sat Apr 18, 2020 6:49 am
by Jaska
Got the brick spinning. It's so short time as the brick flies.. So the main importance is to have bricks on different positions after destruction and this works just fine:

Code: Select allExpand view
   Spawn:
      AAAA AAAAAAA 1 nodelay
      {
         A_SetAngle(15*random(0,23));
         A_SetPitch(4*random(-5,5));
         A_SetScale(0.2*random(-1,1)+1);
      }
      AAAA A -1