C# Class Nez.PhysicsShapes.Box

special case of a Polygon. When doing SAT collision checks we only need to check 2 axes instead of 8
Inheritance: Polygon
Datei anzeigen Open project: prime31/Nez Class Usage Examples

Public Properties

Property Type Description
height float
width float

Public Methods

Method Description
Box ( float width, float height ) : Microsoft.Xna.Framework
collidesWithShape ( Shape other, CollisionResult &result ) : bool
containsPoint ( Vector2 point ) : bool
overlaps ( Shape other ) : bool
pointCollidesWithShape ( Vector2 point, CollisionResult &result ) : bool
updateBox ( float width, float height ) : void

updates the Box points, recalculates the center and sets the width/height

Private Methods

Method Description
buildBox ( float width, float height ) : Vector2[]

helper that builds the points a Polygon needs in the shape of a box

Method Details

Box() public method

public Box ( float width, float height ) : Microsoft.Xna.Framework
width float
height float
return Microsoft.Xna.Framework

collidesWithShape() public method

public collidesWithShape ( Shape other, CollisionResult &result ) : bool
other Shape
result CollisionResult
return bool

containsPoint() public method

public containsPoint ( Vector2 point ) : bool
point Vector2
return bool

overlaps() public method

public overlaps ( Shape other ) : bool
other Shape
return bool

pointCollidesWithShape() public method

public pointCollidesWithShape ( Vector2 point, CollisionResult &result ) : bool
point Vector2
result CollisionResult
return bool

updateBox() public method

updates the Box points, recalculates the center and sets the width/height
public updateBox ( float width, float height ) : void
width float Width.
height float Height.
return void

Property Details

height public_oe property

public float height
return float

width public_oe property

public float width
return float