Introduction The Circle object is commonly used for collision and as a placeholder graphic in game development. Circles can be added to entities which implement the ICollidable interface to act as the entity’s collision shape. Adding a Circle To add a circle to an existing entity: Expand the entity Right-click on the entity’s Objects folder[…]
Introduction The CollideAgainst function is a function which returns whether one shape/ShapeCollection is touching another shape/ShapeCollection. CollideAgainst does not modify the positions or velocities of either of the callers, it simply returns true/false. Common Usage CollideAgainst is often used in the following situations: Damage-dealing collision such as a player entity vs. a bullet entity. Game[…]
Introduction The Visible property on a Circle controls whether the Circle is rendered or not. Invisible Circles will still perform collision properly, so this property does not need to be set if using Circles purely for collision. Rendered circles will render their outline using their Color property. Circles cannot be filled-in, only their outline will[…]
Introduction The IsPointInside method returns whether the argument X,Y are inside the Circle. The X and Y values are absolute values. Code Example The following shows how to check if the Cursor is inside a Circle instance:
float worldX = GuiManager.Cursor.WorldXAt(0);
float worldY = GuiManager.Cursor.WorldYAt(0);
bool isInside = CircleInstance.IsPointInside(worldX, worldY);
Redirect to: FlatRedBall.Math.Geometry.Polygon.Position
Introduction Th LastCollisionTangent returns the vector that represents the surface where the collision last occurred. This can be used for custom physics implementations.
Introduction The GetPointInCircle method returns a random point inside a circle with the argument radius, centered at 0,0. This method returns an even distribution, as opposed to a “random radius, random angle” approach which returns a higher concentration of points at the center of the circle. Code example Add the following using statements:
using FlatRedBall.Math.Geometry; // for Point
Introduction The LastMoveCollisionReposition is a property that exists for all Shapes. This property is set whenever a shape calls CollideAgainstBounce or CollideAgainstMove and the method test results in an actual collision. The LastMoveCollisionReposition property can then be tested to obtain information about collision. Code Example When two AxisAlignedRectangles collide the collision side can be determined[…]
Introduction The ProjectParentVelocityOnLastMoveCollisionTangent method can be used to create realistic collisions between a Circle and any other Shape. The Circle’s version of ProjectParentVelocityOnLastMoveCollisionTangent behaves the same as the Polygon‘s version. For more information, see the Polygon’s ProjectParentVelocityOnLastMoveCollisionTangent article.
Introduction The Circle represents a PositionedObject which can be used to draw circles or conduct circular collision which is very efficient. Circles are created and removed through the ShapeManager. Creating a Circle in Glue Glue supports the creation of Circles in Screens and Entities. To create a Circle in Glue: Expand a Screen or Entity[…]