Download Now

    Reference TArbiter

    Declared in Codebot.Physics.pas on line 824

    TArbiter holds the collision information of two shapes and is passed to the callbacks of a collision handler
      TArbiter = record
      public
        Ref: cpArbiter;
        class operator Implicit(const Value: TArbiter): cpArbiter; inline;
        class operator Implicit(const Value: cpArbiter): TArbiter; inline;
        { True if this refers to nothing }
        function IsNil: Boolean; inline;
        { Ignore the collision until the shapes separate. Returns false so that it
          can be the result of a begin or presolve callback. }
        function Ignore: Boolean;
        { The shapes in the order of the collision handler types }
        procedure GetShapes(out A, B: TShape);
        { The bodies in the order of the collision handler types }
        procedure GetBodies(out A, B: TBody);
        { Returns true if this is the first step the shapes touched }
        function IsFirstContact: Boolean;
        { Returns true in a separate callback when a shape was removed }
        function IsRemoval: Boolean;
        { Call the wildcard handlers of the first or second collision type from a
          handler. Begin and presolve return false if the collision is rejected. }
        function CallWildcardBeginA(Space: cpSpace): Boolean;
        function CallWildcardBeginB(Space: cpSpace): Boolean;
        function CallWildcardPreSolveA(Space: cpSpace): Boolean;
        function CallWildcardPreSolveB(Space: cpSpace): Boolean;
        procedure CallWildcardPostSolveA(Space: cpSpace);
        procedure CallWildcardPostSolveB(Space: cpSpace);
        procedure CallWildcardSeparateA(Space: cpSpace);
        procedure CallWildcardSeparateB(Space: cpSpace);
        { The calculated elasticity of the collision, which may be changed in a
          presolve callback }
        property Restitution: Float read GetRestitution write SetRestitution;
        { The calculated friction of the collision, which may be changed in a
          presolve callback }
        property Friction: Float read GetFriction write SetFriction;
        { The velocity of the surfaces where the shapes touch }
        property SurfaceVelocity: TVec2 read GetSurfaceVelocity write SetSurfaceVelocity;
        { A value of your own kept with the arbiter }
        property UserData: Pointer read GetUserData write SetUserData;
        { The set of points where the shapes touch }
        property ContactPointSet: cpContactPointSetStruct read GetContactPointSet write SetContactPointSet;
        { The number of contact points }
        property Count: Integer read GetCount;
        { The normal of the collision }
        property Normal: TVec2 read GetNormal;
        { The contact points on each shape by index }
        property PointA[Index: Integer]: TVec2 read GetPointA;
        property PointB[Index: Integer]: TVec2 read GetPointB;
        { How far the shapes overlap at a contact point }
        property Depth[Index: Integer]: Float read GetDepth;
        { The impulse applied to resolve the collision in the last step, which
          should be read in a postsolve callback }
        property TotalImpulse: TVec2 read GetTotalImpulse;
        { The energy lost in the collision in the last step }
        property TotalKineticEnergy: Float read GetTotalKineticEnergy;
      end;

    See also

    Float in Codebot.System.pas
    TVec2 in Codebot.Geometry.pas