Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |
00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00023 00024 00025 00026 00027 00028 00029 00030 00031 00032 00033 00034 00035 00036 00037 00038 00039 00040 00041 00042 00043 00044 00045 00046 00047 00048 00049 00050 00051 00052 00053 00054 00055 00056 00057 00058 00059 00060 00061 00062 00063 00064 00065 00066 00067 00068 00069 00070 00071 00072 00073 00074 00075 00076 |
class HumanMotionSensor extends Sensor config (USARBot); var config float MaxRange; var config float FOV; var float MaxSpeed; var float uuMaxRange; var float uuMaxSpeed; function ConvertParam(USARConverter converter) { if (converter!=None) { uuMaxRange = converter.LengthToUU(MaxRange); uuMaxSpeed = converter.SpeedToUU(MaxSpeed); } else { uuMaxRange = MaxRange; uuMaxSpeed = MaxSpeed; } } function String GetData() { local string Outstring; local vector SegLoc,SegVel,HitLocation,HitNormal; local float CosAngle,Distance,Speed,Prob; local array<USARVictim> Victims; local int i,j; local actor a; Outstring=""; Victims = USARDeathMatch(Level.Game).Victims; for (i=0;i<Victims.length;i++) { for (j=0;j<8;j++) { // static segment SegVel = Victims[i].getSegmentVel(j); if (SegVel.X==0 && SegVel.Y==0 && SegVel.Z==0) Continue; // not in valid range SegLoc = Victims[i].getSegmentLocation(j); Distance = VSize(SegLoc-Location); if (Distance>uuMaxRange) continue; // not in FOV CosAngle = ((SegLoc - Location) dot vector(Rotation)) / Distance; // VSize(vector(Rotation))=1; if (CosAngle<Cos(FOV/2.0)) Continue; // FOV/2 // no obstacles between the sensor and the victim a = Trace(HitLocation, HitNormal, SegLoc, Location, true); if (a!=None && a!=Victims[i]) Continue; // get moving speed Speed = SegVel dot vector(Rotation); Speed = Sqrt((SegVel.X*SegVel.X+SegVel.Y*SegVel.Y+SegVel.Z*SegVel.Z) - Speed*Speed); if (Speed>uuMaxSpeed) Speed=uuMaxSpeed; Prob=(1.0-Distance/uuMaxRange)*(Speed/uuMaxSpeed)*CosAngle; Outstring="{Prob "$converter.FloatString(Prob)$"}"; break; } if (Speed>0) break; } if (Outstring!="") Outstring = super.GetData()@OutString; return Outstring; } function String GetConfData() { local string outstring; outstring = Super.GetConfData(); outstring = outstring@"{MaxRange "$converter.FloatString(MaxRange)$"} {Fov "$converter.FloatString(FOV)$"}"; return outstring; } defaultproperties { ItemType="HumanMotion" MaxRange=3 // 3 meter MaxSpeed=0.5 // 5 cm/s FOV=1.0472 // 60 deg OutputCurve=(Points=((InVal=0,OutVal=0),(InVal=1000,OutVal=1000))) } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |