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
Afficher le fichier Open project: prime31/Nez Class Usage Examples

Méthodes publiques

Свойство Type Description
height float
width float

Méthodes publiques

Méthode 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

Méthode 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 méthode

public Box ( float width, float height ) : Microsoft.Xna.Framework
width float
height float
Résultat Microsoft.Xna.Framework

collidesWithShape() public méthode

public collidesWithShape ( Shape other, CollisionResult &result ) : bool
other Shape
result CollisionResult
Résultat bool

containsPoint() public méthode

public containsPoint ( Vector2 point ) : bool
point Vector2
Résultat bool

overlaps() public méthode

public overlaps ( Shape other ) : bool
other Shape
Résultat bool

pointCollidesWithShape() public méthode

public pointCollidesWithShape ( Vector2 point, CollisionResult &result ) : bool
point Vector2
result CollisionResult
Résultat bool

updateBox() public méthode

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.
Résultat void

Property Details

height public_oe property

public float height
Résultat float

width public_oe property

public float width
Résultat float