Photon Quantum 3.0.0

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

Defines a 3D 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 3D box shape in its local space. In order to create a Shape3D of type Shape3DType.Box, use Shape3D.CreateBox.

See also
Shape3D, Shape3DType
More...
 
struct  CapsuleShape
 Defines a 3D capsule shape in its local space. In order to create a Shape3D of type Shape3DType.Capsule, use Shape3D.CreateCapsule.

See also
Shape3D, Shape3DType
More...
 
struct  CompoundShape3D
 A 3D shape type that can reference a group of other 3D shapes (including other compounds, but not Mesh and Terrain shapes). Compound shape overlaps and physics colliders with compound shapes are supported. More...
 
struct  MeshShape
 References a static Mesh collider by its index. More...
 
struct  SphereShape
 Defines a sphere shape in its local space. In order to create a Shape3D of type Shape3DType.Sphere, use Shape3D.CreateSphere.

See also
Shape3D, Shape3DType
More...
 
struct  TerrainShape
 References a static Terrain shape by its Quantum.TerrainCollider asset. More...
 

Public Member Functions

override int GetHashCode ()
 Overrides the hash code generation of this type. More...
 
FPVector3 GetLocalSupport (FrameBase f, FPVector3 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 Shape3D CreateBox (FPVector3 extents, FPVector3? posOffset=null, FPQuaternion? rotOffset=null)
 Creates a 3D box shape defined by extents . More...
 
static Shape3D CreateCapsule (FP radius, FP extent, FPVector3? posOffset=null, FPQuaternion? rotOffset=null)
 Creates a 3D capsule shape. More...
 
static Shape3D CreatePersistentCompound ()
 Creates a compound shape that composed by a group of other 3D shapes (including other compounds). More...
 
static Shape3D CreateSphere (FP radius, FPVector3? posOffset=null)
 Creates a 3D sphere shape defined by a radius . More...
 
static void Serialize (void *ptr, FrameSerializer serializer)
 Serializes a Shape3D 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...
 
FPVector3 Centroid
 The offset position of the shape center related to the entity's position. More...
 
CompoundShape3D Compound
 The CompoundShape3D in the shape if it's type of compound. More...
 
Transform3D LocalTransform
 The offset position and rotation of the shape related to the entity's transform. More...
 
MeshShape Mesh
 The MeshShape in the shape if it's type of mesh. More...
 
SphereShape Sphere
 The SphereShape in the shape if it's type of sphere. More...
 
TerrainShape Terrain
 The TerrainShape in the shape if it's type of terrain. More...
 
Shape3DType Type => _type
 Returns the type of the shape. More...
 
UInt16 UserTag
 Set a number tag to identify a shape. More...
 

Static Public Attributes

const int SIZE = SHAPE_DATA + BoxShape.SIZE
 The size of the struct in bytes. More...
 

Detailed Description

Defines a 3D 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

◆ CreateSphere()

static Shape3D Quantum.Shape3D.CreateSphere ( FP  radius,
FPVector3 posOffset = null 
)
inlinestatic

Creates a 3D sphere shape defined by a radius .

Parameters
radiusThe radius of the sphere
posOffsetThe offset of the shape in the Shape3D.LocalTransform.
Returns
A Shape3D with the setup and type of a SphereShape.

◆ CreateBox()

static Shape3D Quantum.Shape3D.CreateBox ( FPVector3  extents,
FPVector3 posOffset = null,
FPQuaternion rotOffset = null 
)
inlinestatic

Creates a 3D box shape defined by extents .

Parameters
extentsThe extents of the box, 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 Shape3D.LocalTransform.
rotOffsetThe rotation offset of the shape in the Shape3D.LocalTransform.
Returns
A Shape3D with the setup and type of a BoxShape.

◆ CreateCapsule()

static Shape3D Quantum.Shape3D.CreateCapsule ( FP  radius,
FP  extent,
FPVector3 posOffset = null,
FPQuaternion rotOffset = null 
)
inlinestatic

Creates a 3D capsule shape.

Parameters
radiusRadius of the cylinder and semi-spheres that compose the capsule.
extentDistance from the center of the capsule to the top of the internal cylinder. This is NOT the capsule Height.

Height = 2 * (Radius + Extent)

Extent = (Height / 2) - Radius

Parameters
posOffsetOffset of the center of the capsule relative to its collider or query position.
rotOffsetRotation offset of the capsule relative to its collider or query rotation.
Returns

◆ CreatePersistentCompound()

static Shape3D Quantum.Shape3D.CreatePersistentCompound ( )
inlinestatic

Creates a compound shape that composed by a group of other 3D shapes (including other compounds).

Returns
A Shape3D with the setup and type of an CompoundShape3D.

◆ GetLocalSupport()

FPVector3 Quantum.Shape3D.GetLocalSupport ( FrameBase  f,
FPVector3  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.Shape3D.Serialize ( void *  ptr,
FrameSerializer  serializer 
)
inlinestatic

Serializes a Shape3D into a FrameSerializer.

Parameters
ptrThe pointer to the Shape3D.
serializerThe FrameSerializer instance into which the struct will be serialized.

◆ GetHashCode()

override int Quantum.Shape3D.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.Shape3D.SIZE = SHAPE_DATA + BoxShape.SIZE
static

The size of the struct in bytes.

◆ UserTag

UInt16 Quantum.Shape3D.UserTag

Set a number tag to identify a shape.

◆ LocalTransform

Transform3D Quantum.Shape3D.LocalTransform

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

◆ Centroid

FPVector3 Quantum.Shape3D.Centroid

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

◆ Compound

CompoundShape3D Quantum.Shape3D.Compound

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

◆ BroadRadius

FP Quantum.Shape3D.BroadRadius

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

◆ Mesh

MeshShape Quantum.Shape3D.Mesh

The MeshShape in the shape if it's type of mesh.

◆ Sphere

SphereShape Quantum.Shape3D.Sphere

The SphereShape in the shape if it's type of sphere.

◆ Box

BoxShape Quantum.Shape3D.Box

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

◆ Capsule

CapsuleShape Quantum.Shape3D.Capsule

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

◆ Terrain

TerrainShape Quantum.Shape3D.Terrain

The TerrainShape in the shape if it's type of terrain.

◆ Type

Shape3DType Quantum.Shape3D.Type => _type

Returns the type of the shape.