Urho.Urho2D.CollisionShape2D Class

2D collision shape component.

See Also: CollisionShape2D


public class CollisionShape2D : Component


This implements Box2D fixtures and Collision Filtering.

Box2D supports collision filtering (restricting which other objects to collide with) using categories and groups:

Collision categories: First assign the collision shape to a category, using P:Urho.Urho2D.CollisionShape2D.CategoryBits. Sixteen categories are available.

Then you can specify what other categories the given collision shape can collide with, using P:Urho.Urho2D.CollisionShape2D.MaskBits.

Collision groups: positive and negative indices assigned using P:Urho.Urho2D.CollisionShape2D.GroupIndex. All collision shapes within the same group index either always collide (positive index) or never collide (negative index).

Note that:
  • a collision group has higher precedence than collision category
  • a collision shape on a static body can only collide with a dynamic body
  • a collision shape on a kinematic body can only collide with a dynamic body
  • collision shapes on the same body never collide with each other

A collision shape can be set to trigger mode to only report collisions without actually applying collision forces. This can be used to implement trigger areas. Note that:


A sensor can be triggered only by dynamic bodies T:Urho.Urho2D.BodyType2D’s Dynamic.

Physics queries don't report triggers. To get notified when a sensor is triggered or cease to be triggered, subscribe to E:Urho.Urho2D.PhysicsWorld2D.PhysicsBeginContact2D and E:Urho.Urho2D.PhysicsWorld2D.PhysicsEndContact2D physics events.


Namespace: Urho.Urho2D
Assembly: Urho (in Urho.dll)
Assembly Versions:

The members of Urho.Urho2D.CollisionShape2D are listed below.

See Also: Component

Public Constructors

Constructs a new instance of Urho.Urho2D.CollisionShape2D, given a raw pointer to an unmanaged object

Protected Constructors

Empty constructor, chain to this constructor when you provide your own constructor that sets the handle field.

Public Properties

CategoryBitsInt32. Return filter category bits. Or Set filter category bits.
DensitySingle. Return density. Or Set density.
FrictionSingle. Return friction. Or Set friction.
GroupIndexInt32. Return filter group index. Or Set filter group index.
InertiaSingle. Return inertia.
MaskBitsInt32. Return filter mask bits. Or Set filter mask bits.
MassSingle. Return mass.
MassCenterVector2. Return mass center.
RestitutionSingle. Return restitution. Or Set restitution .
TriggerBoolean. Controls the trigger.
TypeStringHash. Urho's type system type.
TypeNameString. Urho's low-level type name.
TypeNameStaticString. Urho's low-level type name, accessible as a static method.
TypeStaticStringHash. Urho's low-level type, accessible as a static method.

Public Methods

Create fixture.
Handle enabled/disabled state change.
Register object factory.
Release fixture.