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...
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... | |
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.
|
inlinestatic |
Creates a physics collider component with a Shape2D.
f | The frame. |
shape | The 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. |
material | The physics material asset object. If null, it will use the default physics material. |
isTrigger | If the collider is trigger. False by default. |
layer | The index of the layer the collider belongs to. |
|
inlinestatic |
Serializes a PhysicsCollider2D into a FrameSerializer.
ptr | The pointer to the PhysicsCollider2D. |
serializer | The FrameSerializer instance into which the struct will be serialized. |
|
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.
|
getset |
The index of the layer this collider belongs to.
The collision matrix between layers can be configured in the Simulation Config.
|
getset |
If the collider is trigger.
|
getset |
The asset reference of the physics material used by this collider. See PhysicsMaterial for more details.
|
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.