AxisAlignedRectangle

Introduction AxisAlignedRectangles are rectangular shapes which cannot be rotated. AxisAlignedRectangles can be used as collision objects. For information on using AxisAlignedRectangles in code, see the AxisAlignedRectangle code page. Adding an AxisAlignedRectangle to an entity To add an AxisAlignedRectangle to an entity: Expand your entity Right-click on the Objects item Select “Add Object” Enter the name[…]

CollideAgainst

Introduction Sprite collision methods are obsolete! The Sprite collision methods were written long before Entities and Glue. During that time the Sprite was intended to contain its own collision; however, now the Entity pattern has replaced this approach. The collision methods in the Sprite class have been left in but instead we recommend using the[…]

FlatRedBall.Graphics.Particle.Emitter:Particle Collision

Introduction Particles which are emitted by Emitters are fully-functional Sprites which means they have the full set of functionality. This article presents code which creates an Emitter, then adds collision to the emitted Sprites. Finally these emitted Sprites are collided against an AxisAlignedRectangle. Update The following example was written at a time when the SetCollision[…]

FlatRedBall.Math.Geometry.Polygon.CreateRectangle

Introduction The CreateRectangle method creates a Polygon that is in the shape of a rectangle. Polygons created through the CreateRectangle method are no different than any other Polygon – the CreateRectangle method is simply a method that simplifies a common task. Since Polygons and AxisAlignedRectangles have the same methods for performing collision and both inherit[…]

Introduction to Collision

Introduction The term “collision” in game development refers to both detecting whether objects are touching as well as changing the state of these objects when this touching occurs. Virtually any game ever made requires some type of collision. For example, Pong used ball vs. paddle collision and Super Mario Bros. performs collision between Mario and[…]

Axis Alignment and Rotation

Introduction Although AxisAlignedRectangles inherit from the PositionedObject class, which inherits from the IRotatable interface, AxisAlignedRectangles cannot be visibly rotated. This article discusses how rotation values are applied to AxisAlignedRectangles. AxisAlignment and the collision/visible representation of an AxisAlignedRectangle As far as the visible representation and collision behavior of an AxisAlignedRectangle, rotation will have no impact on[…]

Shapes and 2D Collision

Introduction The 2D shapes in the FlatRedBall.Math.Geometry namespace provide useful methods for detecting and reacting to collisions. The following lists the 2D shapes: AxisAlignedRectangle Capsule2D Circle Line Polygon These objects provide methods for performing collision against one another. While these objects can be positioned and in some case rotated in 3D space, the collisions they[…]

Shape

Introduction The ShapeManager is responsible for managing “Shapes”. Shapes are most often used for collision between objects. Objects which belong to the Shape categorization are: AxisAlignedCube AxisAlignedRectangle Capsule2D Circle Line Polygon Sphere All of these objects share the PositionedObject base class. These are the only objects which the ShapeManager manages. Although there is no “Shape”[…]

FlatRedBall.Math.Geometry.Polygon.CollideAgainstMove

Introduction The CollideAgainstMove is a method which can be used to test whether two Shapes are touching, and if they are to move one or both so that they no longer overlap. CollideAgainstMove also works between all types of shapes. The CollideAgainstMove is a very common method used in games which include solid collision. Sometimes[…]

MaximumX

Introduction The MaximumX, MaximumY, MinimumX, and MinimumY properties can set the minimum and maximum X and Y positional values for a given Camera. These properties can be used to create boundaries beyond which the camera cannot move. These are often used in games to keep the camera viewing the playable area and keep areas beyond[…]