Photon Quantum 3.0.0

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

A component with a shape used to represent 2D physics objects in the physics simulation. You can use flags and layers to setup how the object interacts with other colliders. More...

Inheritance diagram for Quantum.PhysicsCollider2D:
Quantum.IComponent

Static Public Member Functions

static PhysicsCollider2D Create (FrameBase f, Shape2D shape, PhysicsMaterial material=null, bool isTrigger=false, int layer=default)
 Creates a physics collider component with a Shape2D. More...
 
static void Serialize (void *ptr, FrameSerializer serializer)
 Serializes a PhysicsCollider2D into a FrameSerializer. More...
 

Public Attributes

Shape2D Shape
 The Shape2D used by the collider. More...
 

Static Public Attributes

const int SIZE = sizeof(Int32) * 2 + AssetRef<PhysicsMaterial>.SIZE + Shape2D.SIZE
 The size of the component (or struct/type) in-memory inside the Frame data-buffers or stack (when passed as value parameter). Not related to the snapshot payload this occupies, which is bit-packed and compressed. More...
 

Properties

Boolean? Enabled [get, set]
 If this component should be considered by the Physics Engine. More...
 
Boolean? IsTrigger [get, set]
 If the collider is trigger. More...
 
Int32 Layer [get, set]
 The index of the layer this collider belongs to. More...
 
AssetRef< PhysicsMaterial >? Material [get, set]
 The asset reference of the physics material used by this collider. See PhysicsMaterial for more details. More...
 

Detailed Description

A component with a shape used to represent 2D physics objects in the physics simulation. You can use flags and layers to setup how the object interacts with other colliders.

Member Function Documentation

◆ Create()

static PhysicsCollider2D Quantum.PhysicsCollider2D.Create ( FrameBase  f,
Shape2D  shape,
PhysicsMaterial  material = null,
bool  isTrigger = false,
int  layer = default 
)
inlinestatic

Creates a physics collider component with a Shape2D.

Parameters
fThe frame.
shapeThe shape to be used by this collider. If the provided shape is a Shape2D.CompoundShape2D, this collider will create a deep, persistent copy of the provided compound, which will be disposed automatically when this component is removed from an entity.
materialThe physics material asset object. If null, it will use the default physics material.
isTriggerIf the collider is trigger. False by default.
layerThe index of the layer the collider belongs to.
Returns
An instance of physics collider component.

◆ Serialize()

static void Quantum.PhysicsCollider2D.Serialize ( void *  ptr,
FrameSerializer  serializer 
)
inlinestatic

Serializes a PhysicsCollider2D into a FrameSerializer.

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

Member Data Documentation

◆ SIZE

const int Quantum.PhysicsCollider2D.SIZE = sizeof(Int32) * 2 + AssetRef<PhysicsMaterial>.SIZE + Shape2D.SIZE
static

The size of the component (or struct/type) in-memory inside the Frame data-buffers or stack (when passed as value parameter). Not related to the snapshot payload this occupies, which is bit-packed and compressed.

◆ Shape

Shape2D Quantum.PhysicsCollider2D.Shape

The Shape2D used by the collider.

Property Documentation

◆ Layer

Int32 Quantum.PhysicsCollider2D.Layer
getset

The index of the layer this collider belongs to.

The collision matrix between layers can be configured in the Simulation Config.

◆ IsTrigger

Boolean? Quantum.PhysicsCollider2D.IsTrigger
getset

If the collider is trigger.

◆ Material

AssetRef<PhysicsMaterial>? Quantum.PhysicsCollider2D.Material
getset

The asset reference of the physics material used by this collider. See PhysicsMaterial for more details.

◆ Enabled

Boolean? Quantum.PhysicsCollider2D.Enabled
getset

If this component should be considered by the Physics Engine.

Disabling a collider has immediate effect: queries will not find it, nor will collisions be solved nor callbacks called. If a collider is re-enabled after the Physics system has already run on this frame, the collider will be re-enabled on the next frame.