home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Diversos / pup_idol.swf / scripts / Box2D / Dynamics / Contacts / b2PolyContact.as < prev   
Encoding:
Text File  |  2008-08-07  |  3.0 KB  |  99 lines

  1. package Box2D.Dynamics.Contacts
  2. {
  3.    import Box2D.Collision.*;
  4.    import Box2D.Collision.Shapes.*;
  5.    import Box2D.Common.*;
  6.    import Box2D.Common.Math.*;
  7.    import Box2D.Dynamics.*;
  8.    
  9.    public class b2PolyContact extends b2Contact
  10.    {
  11.        
  12.       
  13.       public var m_manifold:Array;
  14.       
  15.       private var m0:b2Manifold;
  16.       
  17.       public function b2PolyContact(param1:b2Shape, param2:b2Shape)
  18.       {
  19.          m0 = new b2Manifold();
  20.          m_manifold = [new b2Manifold()];
  21.          super(param1,param2);
  22.          m_manifold[0].pointCount = 0;
  23.       }
  24.       
  25.       public static function Destroy(param1:b2Contact, param2:*) : void
  26.       {
  27.       }
  28.       
  29.       public static function Create(param1:b2Shape, param2:b2Shape, param3:*) : b2Contact
  30.       {
  31.          return new b2PolyContact(param1,param2);
  32.       }
  33.       
  34.       override public function Evaluate() : void
  35.       {
  36.          var _loc4_:b2ContactPoint = null;
  37.          var _loc5_:b2ContactPoint = null;
  38.          var _loc6_:Array = null;
  39.          var _loc7_:int = 0;
  40.          var _loc8_:b2ContactPoint = null;
  41.          var _loc9_:uint = 0;
  42.          var _loc10_:int = 0;
  43.          var _loc11_:b2ContactPoint = null;
  44.          var _loc12_:b2ContactID = null;
  45.          var _loc1_:b2Manifold = m_manifold[0];
  46.          var _loc2_:Array = m0.points;
  47.          var _loc3_:int = 0;
  48.          while(_loc3_ < _loc1_.pointCount)
  49.          {
  50.             _loc4_ = _loc2_[_loc3_];
  51.             _loc5_ = _loc1_.points[_loc3_];
  52.             _loc4_.normalImpulse = _loc5_.normalImpulse;
  53.             _loc4_.tangentImpulse = _loc5_.tangentImpulse;
  54.             _loc4_.id = _loc5_.id.Copy();
  55.             _loc3_++;
  56.          }
  57.          m0.pointCount = _loc1_.pointCount;
  58.          b2Collision.b2CollidePoly(_loc1_,m_shape1 as b2PolyShape,m_shape2 as b2PolyShape,false);
  59.          if(_loc1_.pointCount > 0)
  60.          {
  61.             _loc6_ = [false,false];
  62.             _loc7_ = 0;
  63.             while(_loc7_ < _loc1_.pointCount)
  64.             {
  65.                (_loc8_ = _loc1_.points[_loc7_]).normalImpulse = 0;
  66.                _loc8_.tangentImpulse = 0;
  67.                _loc9_ = _loc8_.id.key;
  68.                _loc10_ = 0;
  69.                while(_loc10_ < m0.pointCount)
  70.                {
  71.                   if(_loc6_[_loc10_] != true)
  72.                   {
  73.                      if((_loc12_ = (_loc11_ = m0.points[_loc10_]).id).key == _loc9_)
  74.                      {
  75.                         _loc6_[_loc10_] = true;
  76.                         _loc8_.normalImpulse = _loc11_.normalImpulse;
  77.                         _loc8_.tangentImpulse = _loc11_.tangentImpulse;
  78.                         break;
  79.                      }
  80.                   }
  81.                   _loc10_++;
  82.                }
  83.                _loc7_++;
  84.             }
  85.             m_manifoldCount = 1;
  86.          }
  87.          else
  88.          {
  89.             m_manifoldCount = 0;
  90.          }
  91.       }
  92.       
  93.       override public function GetManifolds() : Array
  94.       {
  95.          return m_manifold;
  96.       }
  97.    }
  98. }
  99.