Author Topic: Get*ObjectInShape - Half-Circles  (Read 489 times)

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
Get*ObjectInShape - Half-Circles
« Reply #15 on: September 17, 2013, 04:26:33 am »


               Here is a fabs rendition for those who are curious


int GetIsFlanked(object oAttacker, object oTarget, float fAngle = 90.0, object oAlly = OBJECT_INVALID)
{
float fToAttacker = VectorToAngle(GetPosition(oAttacker)- GetPosition(oTarget));
float fToFacing;
if(GetIsObjectValid(oAlly))
    fToFacing = VectorToAngle(GetPosition(oAlly) - GetPosition(oTarget));
else
    fToFacing = GetFacing(oTarget);
float fBackArc = fabs(fabs(fToAttacker - fToFacing) - 180.0);
return (fBackArc <= fAngle/2);
}
               
               

               


                     Modifié par WhiZard, 17 septembre 2013 - 03:29 .
                     
                  


            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Get*ObjectInShape - Half-Circles
« Reply #16 on: September 22, 2013, 05:15:08 pm »


               @WhiZ:  Nice work on the double absolute.
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Get*ObjectInShape - Half-Circles
« Reply #17 on: September 22, 2013, 06:34:21 pm »


               Could one of you add a commented declaration to make clear precisely when it will return flanking/not flanking? I'm a little fuzzy on who's flanking what.

Thanks,
Funky
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Get*ObjectInShape - Half-Circles
« Reply #18 on: September 22, 2013, 07:12:34 pm »


               Flanking is probably not the best word to use.   It is more of an opposing or on opposite sides.   we are checking to see if an ally is on the side of the target from the attacker.  

Or in the gray shaded area below.

'Posted

The facing of  the target does not matter.   the only check I am doing is to see if they are opposing.  

In WiZards version.   He accounted for just a single attacker with no ally  comming in from behind the target,     

note: both scripts would fail to return a TRUE result if both attacker and ally where coming in from behind the target.   They are checking more for opposition then flanking.
               
               

               


                     Modifié par Lightfoot8, 22 septembre 2013 - 06:20 .
                     
                  


            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Get*ObjectInShape - Half-Circles
« Reply #19 on: September 23, 2013, 01:02:51 am »


               Ah, ok, I thought that's what I was reading. I guess in my mind, for a get is flanking function you would just want to know the facing of the target and the position of the attacker - not what the OP specifically requested, I know, but not all that different in the end.

Thanks,
Funky
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Get*ObjectInShape - Half-Circles
« Reply #20 on: September 23, 2013, 02:29:46 am »


                I guess it would have helped if i stated I had finally finished my response above, (5 day later). 
 Link
               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
Get*ObjectInShape - Half-Circles
« Reply #21 on: September 23, 2013, 03:45:16 am »


               

FunkySwerve wrote...

Ah, ok, I thought that's what I was reading. I guess in my mind, for a get is flanking function you would just want to know the facing of the target and the position of the attacker - not what the OP specifically requested, I know, but not all that different in the end.

Thanks,
Funky


There are two approaches generally.

1) Backstab: give the target damage/penalties when attacked from behind.  For this approach the direction the target is facing is important.

2) Volleying: give the target incrementing damage/penalties as long as it remains between two creatures pushing it back and forth with their blows.  For this approach the position of the ally is important.

While my function can be used for both approaches (neglect the ally parameter if you are backstabbing), the OP seemed to describe a backstab model while asking for a function factoring in the position of the ally.  So I am not 100% sure if this addresses his concern.
               
               

               
            

Legacy_Vermain

  • Newbie
  • *
  • Posts: 12
  • Karma: +0/-0
Get*ObjectInShape - Half-Circles
« Reply #22 on: September 24, 2013, 12:04:23 am »


               Just wanted to say again: Thanks a whole bunch for all of this, everyone! It helps immensely. I finally think I'm starting to understand vectors (at long last!).