Skip to content

Physics

Alex Miyamoto edited this page Apr 23, 2018 · 2 revisions

RigidBodies

Unless the rigidbody is marked as a kinematic body, the TransformComponent of the entity is driven by the PhysicsSystem: do not modify the transform manually. On the other hand, the transform of a kinematic body is set up manually by modifying the TransformComponent, which must happen in a system with priority number larger than SYSTEM_FETCH_VEHICLE_SIMULATION_RESULTS.

Shapes

There are two types of shapes: non-trigger shapes and trigger shapes (specified by the bIsTrigger variable).

Non-trigger shapes are attached to nearest parent/self RigidBody component (which must exist in the hierarchy) and when the shape collides, OnCollision signals are always handled by the entity with RigidBody component.

For trigger shapes, the OnTrigger event receiver is the entity which has the trigger shape component.

CollisionMasks

Two shapes collide if shape0.uGroup & shape1.uFilter | shape1.uGroup & shape0.uFilter is larger than zero. This implies that collisions are always symmetric unlike in the old Usagi physics system. However, for any entity, OnCollision signals are generated only when the collider's uGroup shares bits with the entity's uFilter.

To update CollisionMasks after loading, use the UpdateCollisionMasks event, do not modify CollisionMasks component's data directly.