Urho.Urho2D.CollisionShape2D Class

2D collision shape component.

See Also: CollisionShape2D

Syntax

public class CollisionShape2D : Component

Remarks

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:

Sensors

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.

Requirements

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

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.
[read-only]
InertiaSingle. Return inertia.
MaskBitsInt32. Return filter mask bits. Or Set filter mask bits.
[read-only]
MassSingle. Return mass.
[read-only]
MassCenterVector2. Return mass center.
RestitutionSingle. Return restitution. Or Set restitution .
TriggerBoolean. Controls the trigger.
[read-only]
override
TypeStringHash. Urho's type system type.
[read-only]
override
TypeNameString. Urho's low-level type name.
[read-only]
static
TypeNameStaticString. Urho's low-level type name, accessible as a static method.
[read-only]
static
TypeStaticStringHash. Urho's low-level type, accessible as a static method.

Public Methods

CreateFixture()
Create fixture.
override
OnSetEnabled()
Handle enabled/disabled state change.
static
RegisterObject(Context)
Register object factory.
ReleaseFixture()
Release fixture.