Defines a 2D shape with Type and data disposed in a union-like structure. All shapes have a UserTag, BroadRadius and Centroid. All non-compound shapes have a LocalTransform and their Centroid always match their local transform position.
More...
|
static Shape2D | CreateBox (FPVector2 extents, FPVector2 posOffset=default, FP rotOffset=default) |
| Creates a 2D box shape defined by extents . More...
|
|
static Shape2D | CreateCapsule (FP radius, FP extent, FPVector2 posOffset=default, FP rotOffset=default) |
| Creates a 2D capsule shape defined by a radius and an extent . More...
|
|
static Shape2D | CreateCircle (FP radius, FPVector2 posOffset=default) |
| Creates a 2D circle shape. More...
|
|
static Shape2D | CreateEdge (FP extent, FPVector2 posOffset=default, FP rotOffset=default) |
| Creates a 2D edge shape defined by an extent . More...
|
|
static Shape2D | CreatePersistentCompound () |
| Creates a compound shape that composed by a group of other 2D shapes (including other compounds). More...
|
|
static Shape2D | CreatePolygon (MapStaticCollider2DPolygonData asset, FPVector2 posOffset=default, FP rotOffset=default) |
|
static Shape2D | CreatePolygon (PolygonCollider asset, FPVector2 posOffset=default, FP rotOffset=default) |
| Creates a 2D polygon shape using a polygon collider asset . More...
|
|
static void | Serialize (void *ptr, FrameSerializer serializer) |
| Serializes a Shape2D into a FrameSerializer. More...
|
|
|
const int | SIZE = 8 + CompoundShape2D.SIZE |
| The size of the struct in bytes. More...
|
|
Defines a 2D shape with Type and data disposed in a union-like structure. All shapes have a UserTag, BroadRadius and Centroid. All non-compound shapes have a LocalTransform and their Centroid always match their local transform position.
◆ CreateCircle()
Creates a 2D circle shape.
- Parameters
-
- Returns
- A Shape2D with the setup and type of a CircleShape.
◆ CreatePolygon()
Creates a 2D polygon shape using a polygon collider asset .
- Parameters
-
- Returns
- A Shape2D with the setup and type of a PolygonShape.
◆ CreateBox()
Creates a 2D box shape defined by extents .
- Parameters
-
extents | The box extents, a vector that defines the distance from the box centroid to the furthest point in the positive direction of each axis. |
posOffset | The position offset of the shape in the Shape2D.LocalTransform. |
rotOffset | The rotation offset of the shape in the Shape2D.LocalTransform. |
- Returns
- A Shape2D with the setup and type of a BoxShape.
◆ CreateEdge()
static Shape2D Quantum.Shape2D.CreateEdge |
( |
FP |
extent, |
|
|
FPVector2 |
posOffset = default , |
|
|
FP |
rotOffset = default |
|
) |
| |
|
inlinestatic |
Creates a 2D edge shape defined by an extent .
- Parameters
-
extent | The edge extent, a value that defines the distance from the edge centroid to the furthest point in either direction of its elongated axis. |
posOffset | The position offset of the shape in the Shape2D.LocalTransform. |
rotOffset | The rotation offset of the shape in the Shape2D.LocalTransform. |
- Returns
- A Shape2D with the setup and type of an EdgeShape.
◆ CreateCapsule()
static Shape2D Quantum.Shape2D.CreateCapsule |
( |
FP |
radius, |
|
|
FP |
extent, |
|
|
FPVector2 |
posOffset = default , |
|
|
FP |
rotOffset = default |
|
) |
| |
|
inlinestatic |
Creates a 2D capsule shape defined by a radius and an extent .
The 'extent' of the capsule is defined as the distance from the center of the shape to the center of any semi-sphere.
- Parameters
-
radius | The radius of the capsule's top and bottom semi-spheres. |
extent | The distance from the capsule's centroid to the center of the top or bottom semi-sphere. |
posOffset | The position offset of the shape in the Shape2D.LocalTransform. |
rotOffset | The rotation offset of the shape in the Shape2D.LocalTransform. |
- Returns
- A Shape2D with the setup and type of an CapsuleShape.
◆ CreatePersistentCompound()
static Shape2D Quantum.Shape2D.CreatePersistentCompound |
( |
| ) |
|
|
inlinestatic |
Creates a compound shape that composed by a group of other 2D shapes (including other compounds).
- Returns
- A Shape2D with the setup and type of an CompoundShape2D.
◆ GetLocalSupport()
Computes a point on the shape which has the highest dot product in a given direction (localDir ), both in the local space of the shape.
- Parameters
-
f | Current frame. |
localDir | The direction, in local space, in which to compute the support point. |
skipNormalize | If the provided direction is already normalized. |
- Returns
- A point, in the local space of the shape, which has the highest dot product in the given direction.
◆ Serialize()
static void Quantum.Shape2D.Serialize |
( |
void * |
ptr, |
|
|
FrameSerializer |
serializer |
|
) |
| |
|
inlinestatic |
Serializes a Shape2D into a FrameSerializer.
- Parameters
-
ptr | The pointer to the Shape2D. |
serializer | The FrameSerializer instance into which the struct will be serialized. |
◆ GetHashCode()
override Int32 Quantum.Shape2D.GetHashCode |
( |
| ) |
|
|
inline |
Overrides the hash code generation of this type.
- Returns
- A hash code of the current state of this instance.
◆ SIZE
const int Quantum.Shape2D.SIZE = 8 + CompoundShape2D.SIZE |
|
static |
The size of the struct in bytes.
◆ UserTag
UInt16 Quantum.Shape2D.UserTag |
Set a number tag to identify a shape.
◆ LocalTransform
The offset position and rotation of the shape related to the entity's transform.
◆ Centroid
The offset position of the shape center related to the entity's position.
◆ Compound
◆ BroadRadius
FP Quantum.Shape2D.BroadRadius |
The radius of an abstract circle that rounds the shape. Used to check the possibility of collision.
◆ Circle
◆ Box
◆ Polygon
◆ Edge
◆ Capsule
◆ Type
Returns the type of the shape.