Photon Quantum 3.0.0

Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Properties | List of all members
Quantum.Shape2D Struct Reference

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...

Classes

struct  BoxShape
 Defines a 2D box in its local space. In order to create a Shape2D of type Shape2DType.Box, use Shape2D.CreateBox.

See also
Shape2D, Shape2DType
More...
 
struct  CapsuleShape
 Defines a 2D capsule in its local space. In order to create a Shape2D of type Shape2DType.Capsule, use Shape2D.CreateCapsule.

See also
Shape2D, Shape2DType
More...
 
struct  CircleShape
 Defines a 2D circle in its local space. In order to create a Shape2D of type Shape2DType.Circle, use Shape2D.CreateCircle.

See also
Shape2D, Shape2DType
More...
 
struct  CompoundShape2D
 A 2D shape type that can reference a group of other 2D shapes (including other compounds). Compound shape overlaps and physics colliders with compound shapes are supported. More...
 
struct  EdgeShape
 Defines a 2D edge in its local space. In order to create a Shape2D of type Shape2DType.Edge, use Shape2D.CreateEdge.

See also
Shape2D, Shape2DType
More...
 
struct  PolygonShape
 References a Polygin shape by the AssetRef<T> of its Quantum.PolygonCollider asset. More...
 

Public Member Functions

override Int32 GetHashCode ()
 Overrides the hash code generation of this type. More...
 
FPVector2 GetLocalSupport (FrameBase f, FPVector2 localDir, bool skipNormalize=false)
 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. More...
 

Static Public Member Functions

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...
 

Public Attributes

BoxShape Box
 The BoxShape in the shape if it's type of box. More...
 
FP BroadRadius
 The radius of an abstract circle that rounds the shape. Used to check the possibility of collision. More...
 
CapsuleShape Capsule
 The CapsuleShape in the shape if it's type of capsule. More...
 
FPVector2 Centroid
 The offset position of the shape center related to the entity's position. More...
 
CircleShape Circle
 The CircleShape in the shape if it's type of circle. More...
 
CompoundShape2D Compound
 The CompoundShape2D in the shape if it's type of compound. More...
 
EdgeShape Edge
 The EdgeShape in the shape if it's type of edge. More...
 
Transform2D LocalTransform
 The offset position and rotation of the shape related to the entity's transform. More...
 
PolygonShape Polygon
 The PolygonShape in the shape if it's type of polygon. More...
 
UInt16 UserTag
 Set a number tag to identify a shape. More...
 

Static Public Attributes

const int SIZE = 8 + CompoundShape2D.SIZE
 The size of the struct in bytes. More...
 

Properties

Shape2DType Type [get]
 Returns the type of the shape. More...
 

Detailed Description

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.

Member Function Documentation

◆ CreateCircle()

static Shape2D Quantum.Shape2D.CreateCircle ( FP  radius,
FPVector2  posOffset = default 
)
inlinestatic

Creates a 2D circle shape.

Parameters
radiusThe radius of the circle
posOffsetThe offset of the shape in the Shape2D.LocalTransform.
Returns
A Shape2D with the setup and type of a CircleShape.

◆ CreatePolygon()

static Shape2D Quantum.Shape2D.CreatePolygon ( PolygonCollider  asset,
FPVector2  posOffset = default,
FP  rotOffset = default 
)
inlinestatic

Creates a 2D polygon shape using a polygon collider asset .

Parameters
assetThe asset the defines the polygon
posOffsetThe position offset of the shape in the Shape2D.LocalTransform.
rotOffsetThe rotation offset of the shape in the Shape2D.LocalTransform.
Returns
A Shape2D with the setup and type of a PolygonShape.

◆ CreateBox()

static Shape2D Quantum.Shape2D.CreateBox ( FPVector2  extents,
FPVector2  posOffset = default,
FP  rotOffset = default 
)
inlinestatic

Creates a 2D box shape defined by extents .

Parameters
extentsThe box extents, a vector that defines the distance from the box centroid to the furthest point in the positive direction of each axis.
posOffsetThe position offset of the shape in the Shape2D.LocalTransform.
rotOffsetThe 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
extentThe edge extent, a value that defines the distance from the edge centroid to the furthest point in either direction of its elongated axis.
posOffsetThe position offset of the shape in the Shape2D.LocalTransform.
rotOffsetThe 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
radiusThe radius of the capsule's top and bottom semi-spheres.
extentThe distance from the capsule's centroid to the center of the top or bottom semi-sphere.
posOffsetThe position offset of the shape in the Shape2D.LocalTransform.
rotOffsetThe 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()

FPVector2 Quantum.Shape2D.GetLocalSupport ( FrameBase  f,
FPVector2  localDir,
bool  skipNormalize = false 
)
inline

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
fCurrent frame.
localDirThe direction, in local space, in which to compute the support point.
skipNormalizeIf 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
ptrThe pointer to the Shape2D.
serializerThe 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.

Member Data Documentation

◆ 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

Transform2D Quantum.Shape2D.LocalTransform

The offset position and rotation of the shape related to the entity's transform.

◆ Centroid

FPVector2 Quantum.Shape2D.Centroid

The offset position of the shape center related to the entity's position.

◆ Compound

CompoundShape2D Quantum.Shape2D.Compound

The CompoundShape2D in the shape if it's type of compound.

◆ BroadRadius

FP Quantum.Shape2D.BroadRadius

The radius of an abstract circle that rounds the shape. Used to check the possibility of collision.

◆ Circle

CircleShape Quantum.Shape2D.Circle

The CircleShape in the shape if it's type of circle.

◆ Box

BoxShape Quantum.Shape2D.Box

The BoxShape in the shape if it's type of box.

◆ Polygon

PolygonShape Quantum.Shape2D.Polygon

The PolygonShape in the shape if it's type of polygon.

◆ Edge

EdgeShape Quantum.Shape2D.Edge

The EdgeShape in the shape if it's type of edge.

◆ Capsule

CapsuleShape Quantum.Shape2D.Capsule

The CapsuleShape in the shape if it's type of capsule.

Property Documentation

◆ Type

Shape2DType Quantum.Shape2D.Type
get

Returns the type of the shape.