Nebula
Loading...
Searching...
No Matches
PhysicsFeature Namespace Reference

Classes

class  CharacterManager
class  PhysicsFeatureUnit
 Sets up and interfaces with the physics subsystem. More...
class  PhysicsManager

Enumerations

enum  PhysicsPending : uint32_t {
  PendingNone = 0 , PendingPose = 1 << 0 , PendingShape = 1 << 1 , PendingBody = 1 << 2 ,
  PendingStructural = 1 << 3 , PendingAll = PendingPose | PendingShape | PendingBody | PendingStructural
}
 what the physics manager has queued for an entity, mixed together in the pending field of the PhysicsActor component. More...

Functions

 __ImplementClass (PhysicsFeature::CharacterManager, 'ChMa', Game::Manager)
void MoveCharacters (Game::World *world, Game::Position &position, Game::Velocity &velocity, Character &character)
 __ImplementClass (PhysicsFeature::PhysicsManager, 'PhMa', Game::Manager)
 __ImplementSingleton (PhysicsManager) PhysicsManager
static Game::Entity ResolveBodyEntity (Game::World *world, Game::Entity entity)
 Resolves which entity owns the physx actor a collider belongs to.
static Physics::ActorId GetValidateActorId (Game::Entity entity, PhysicsFeature::PhysicsActor const &actor)
 Checks if the actorid is valid, and if the actor points to the correct entity, and returns a valid or invalid actor id based on the check.
static Physics::ActorId ResolveActorHandle (Game::World *world, Game::Entity entity)
 get the physx actor of the entity
static bool ActorIsDynamic (Physics::ActorId id)
 True if the actor is a rigid body, which covers both the kinematic and the dynamic actor type.
static Physics::ColliderType ShapeColliderType (physx::PxShape const *pxShape)
 Converts from pxshape to our internal collider type enum.
static bool HasColliderOfType (Game::World *world, Game::Entity entity, int colliderClass)
 True if the entity still has the collider component matching a physx shape of this type.
static bool ShapeBelongsTo (Physics::ShapeId id, Game::Entity entity)
 True when a shape name held by a handle still names the shape its entity built.
static Physics::ShapeId FindShapeForEntity (Physics::ActorId actorId, Game::Entity entity)
static Util::FixedArray< Game::ComponentId > const & ColliderComponents ()
 The collider components.
static bool HasOtherCollider (Game::World *world, Game::Entity entity, Game::ComponentId component)
 True when the entity has a collider component other than this one.
static void ClearShapeField (Game::World *world, Game::Entity entity)
static void GarbageCollectShapes (Game::World *world, Game::Entity bodyEntity, Physics::ActorId actorId)
 Releases the shapes of an actor whose collider component is gone, or whose collider entity has been moved to another body.
static void MarkOwnedShapes (Game::World *world, Physics::ActorId actorId)
 Queues the entities whose shapes hang off an actor which is about to be released, so that their shapes get built again on whichever actor they end up on.
static void BuildActorFromPhysicsResource (Game::World *world, Game::Entity entity, PhysicsFeature::PhysicsActor &self)
static void BuildRigidbody (Game::World *world, Game::Entity entity, PhysicsFeature::PhysicsActor &actor)
static void BuildStaticBody (Game::World *world, Game::Entity entity, PhysicsFeature::PhysicsActor &actor)
static bool BuildCollider (Game::World *world, Game::Entity entity, PhysicsFeature::PhysicsActor &actor, Physics::ColliderDescription &desc)
static bool BuildBoxCollider (Game::World *world, Game::Entity entity, PhysicsFeature::PhysicsActor &actor)
static bool BuildSphereCollider (Game::World *world, Game::Entity entity, PhysicsFeature::PhysicsActor &actor)
static bool BuildCapsuleCollider (Game::World *world, Game::Entity entity, PhysicsFeature::PhysicsActor &actor)
static bool BuildPlaneCollider (Game::World *world, Game::Entity entity, PhysicsFeature::PhysicsActor &actor)
static bool BuildMeshCollider (Game::World *world, Game::Entity entity, PhysicsFeature::PhysicsActor &actor)
static bool BuildHeightFieldCollider (Game::World *world, Game::Entity entity, PhysicsFeature::PhysicsActor &actor)
static void PushActorPose (Game::World *world, Game::Entity entity, Physics::ActorId actorId)
 Pushes the transform of the entity onto its actor.
static bool RebuildPhysicsEntity (Game::World *world, Game::Entity entity, PhysicsFeature::PhysicsActor &actor, uint32_t const pending)
 Creates, updates and releases physx actors and shapes for one entity, according to what is queued for it.
static void EnsureHandle (Game::World *world, Game::Entity entity)
void PollPhysicsResourceTransforms (Game::World *world, Game::Entity entity, Game::Position &position, Game::Orientation &orientation, PhysicsFeature::PhysicsResource const &, PhysicsFeature::PhysicsActor const &handle)
void PassKinematicTransforms (Game::World *world, Game::Entity entity, Game::Position const &position, Game::Orientation const &orientation, PhysicsFeature::PhysicsResource const &, PhysicsFeature::IsKinematic, PhysicsFeature::PhysicsActor const &handle)
void PollRigidbodyTransform (Game::World *world, Game::Entity entity, PhysicsFeature::Rigidbody const &body, Game::Position &position, Game::Orientation &orientation, PhysicsFeature::PhysicsActor const &handle)
void WriteKinematicRigidbody (Game::World *world, Game::Entity entity, PhysicsFeature::Rigidbody const &body, Game::Position const &position, Game::Orientation const &orientation, PhysicsFeature::PhysicsActor const &handle)
 __ImplementClass (PhysicsFeature::PhysicsFeatureUnit, 'PXFU', Game::FeatureUnit)
 __ImplementSingleton (PhysicsFeatureUnit)

Enumeration Type Documentation

◆ PhysicsPending

what the physics manager has queued for an entity, mixed together in the pending field of the PhysicsActor component.

Adding and removing components is picked up by the component inits and decay callbacks, everything else is pinged by whoever changed the entity

Enumerator
PendingNone 

nothing queued for the entity

PendingPose 

push the pose of the actor, and the local pose of its shapes

PendingShape 

build or update the shapes of the collider components

PendingBody 

create or update the physx actor of the body component

PendingStructural 

the actor has to look through its shapes for owners which no longer have a component. Only needed when the handle of an entity cannot name the shape it built, because a handle which can name its shape releases that shape itself

PendingAll 

Function Documentation

◆ __ImplementClass() [1/3]

PhysicsFeature::__ImplementClass ( PhysicsFeature::CharacterManager ,
'ChMa' ,
Game::Manager  )

◆ __ImplementClass() [2/3]

PhysicsFeature::__ImplementClass ( PhysicsFeature::PhysicsFeatureUnit ,
'PXFU' ,
Game::FeatureUnit  )

◆ __ImplementClass() [3/3]

PhysicsFeature::__ImplementClass ( PhysicsFeature::PhysicsManager ,
'PhMa' ,
Game::Manager  )

◆ __ImplementSingleton() [1/2]

PhysicsFeature::__ImplementSingleton ( PhysicsFeatureUnit )

◆ __ImplementSingleton() [2/2]

PhysicsFeature::__ImplementSingleton ( PhysicsManager )

◆ ActorIsDynamic()

bool PhysicsFeature::ActorIsDynamic ( Physics::ActorId id)
static

True if the actor is a rigid body, which covers both the kinematic and the dynamic actor type.

◆ BuildActorFromPhysicsResource()

void PhysicsFeature::BuildActorFromPhysicsResource ( Game::World * world,
Game::Entity entity,
PhysicsFeature::PhysicsActor & self )
static

◆ BuildBoxCollider()

bool PhysicsFeature::BuildBoxCollider ( Game::World * world,
Game::Entity entity,
PhysicsFeature::PhysicsActor & actor )
static

◆ BuildCapsuleCollider()

bool PhysicsFeature::BuildCapsuleCollider ( Game::World * world,
Game::Entity entity,
PhysicsFeature::PhysicsActor & actor )
static

◆ BuildCollider()

bool PhysicsFeature::BuildCollider ( Game::World * world,
Game::Entity entity,
PhysicsFeature::PhysicsActor & actor,
Physics::ColliderDescription & desc )
static

◆ BuildHeightFieldCollider()

bool PhysicsFeature::BuildHeightFieldCollider ( Game::World * world,
Game::Entity entity,
PhysicsFeature::PhysicsActor & actor )
static

◆ BuildMeshCollider()

bool PhysicsFeature::BuildMeshCollider ( Game::World * world,
Game::Entity entity,
PhysicsFeature::PhysicsActor & actor )
static

◆ BuildPlaneCollider()

bool PhysicsFeature::BuildPlaneCollider ( Game::World * world,
Game::Entity entity,
PhysicsFeature::PhysicsActor & actor )
static

◆ BuildRigidbody()

void PhysicsFeature::BuildRigidbody ( Game::World * world,
Game::Entity entity,
PhysicsFeature::PhysicsActor & actor )
static

◆ BuildSphereCollider()

bool PhysicsFeature::BuildSphereCollider ( Game::World * world,
Game::Entity entity,
PhysicsFeature::PhysicsActor & actor )
static

◆ BuildStaticBody()

void PhysicsFeature::BuildStaticBody ( Game::World * world,
Game::Entity entity,
PhysicsFeature::PhysicsActor & actor )
static

◆ ClearShapeField()

void PhysicsFeature::ClearShapeField ( Game::World * world,
Game::Entity entity )
static

◆ ColliderComponents()

Util::FixedArray< Game::ComponentId > const & PhysicsFeature::ColliderComponents ( )
static

The collider components.

An entity is only allowed one of them, so this is the list both the component inits assert against and the caller that asks for one reads.

◆ EnsureHandle()

void PhysicsFeature::EnsureHandle ( Game::World * world,
Game::Entity entity )
static

◆ FindShapeForEntity()

Physics::ShapeId PhysicsFeature::FindShapeForEntity ( Physics::ActorId actorId,
Game::Entity entity )
static

◆ GarbageCollectShapes()

void PhysicsFeature::GarbageCollectShapes ( Game::World * world,
Game::Entity bodyEntity,
Physics::ActorId actorId )
static

Releases the shapes of an actor whose collider component is gone, or whose collider entity has been moved to another body.

Shapes that came along with an actor resource are not tracked by the actor and are left alone. This is the fallback for an entity whose handle cannot name the shape it built; an entity whose handle can name it releases that shape by itself, on the decay of its component.

◆ GetValidateActorId()

Physics::ActorId PhysicsFeature::GetValidateActorId ( Game::Entity entity,
PhysicsFeature::PhysicsActor const & actor )
static

Checks if the actorid is valid, and if the actor points to the correct entity, and returns a valid or invalid actor id based on the check.

◆ HasColliderOfType()

bool PhysicsFeature::HasColliderOfType ( Game::World * world,
Game::Entity entity,
int colliderClass )
static

True if the entity still has the collider component matching a physx shape of this type.

◆ HasOtherCollider()

bool PhysicsFeature::HasOtherCollider ( Game::World * world,
Game::Entity entity,
Game::ComponentId component )
static

True when the entity has a collider component other than this one.

◆ MarkOwnedShapes()

void PhysicsFeature::MarkOwnedShapes ( Game::World * world,
Physics::ActorId actorId )
static

Queues the entities whose shapes hang off an actor which is about to be released, so that their shapes get built again on whichever actor they end up on.

Only shapes built from a collider description are tracked by the actor, and those are the only ones owned by an entity.

◆ MoveCharacters()

void PhysicsFeature::MoveCharacters ( Game::World * world,
Game::Position & position,
Game::Velocity & velocity,
Character & character )

◆ PassKinematicTransforms()

void PhysicsFeature::PassKinematicTransforms ( Game::World * world,
Game::Entity entity,
Game::Position const & position,
Game::Orientation const & orientation,
PhysicsFeature::PhysicsResource const & ,
PhysicsFeature::IsKinematic ,
PhysicsFeature::PhysicsActor const & handle )

◆ PollPhysicsResourceTransforms()

void PhysicsFeature::PollPhysicsResourceTransforms ( Game::World * world,
Game::Entity entity,
Game::Position & position,
Game::Orientation & orientation,
PhysicsFeature::PhysicsResource const & ,
PhysicsFeature::PhysicsActor const & handle )

◆ PollRigidbodyTransform()

void PhysicsFeature::PollRigidbodyTransform ( Game::World * world,
Game::Entity entity,
PhysicsFeature::Rigidbody const & body,
Game::Position & position,
Game::Orientation & orientation,
PhysicsFeature::PhysicsActor const & handle )

◆ PushActorPose()

void PhysicsFeature::PushActorPose ( Game::World * world,
Game::Entity entity,
Physics::ActorId actorId )
static

Pushes the transform of the entity onto its actor.

Only needed for bodies which are not pushed by the poll processors, which is everything that rests where it was put.

◆ RebuildPhysicsEntity()

bool PhysicsFeature::RebuildPhysicsEntity ( Game::World * world,
Game::Entity entity,
PhysicsFeature::PhysicsActor & actor,
uint32_t const pending )
static

Creates, updates and releases physx actors and shapes for one entity, according to what is queued for it.

Returns true if a shape build needs another pass.

◆ ResolveActorHandle()

Physics::ActorId PhysicsFeature::ResolveActorHandle ( Game::World * world,
Game::Entity entity )
static

get the physx actor of the entity

◆ ResolveBodyEntity()

Game::Entity PhysicsFeature::ResolveBodyEntity ( Game::World * world,
Game::Entity entity )
static

Resolves which entity owns the physx actor a collider belongs to.

A collider on a body entity resolves to itself, a collider on a child entity resolves to the body of its parent.

◆ ShapeBelongsTo()

bool PhysicsFeature::ShapeBelongsTo ( Physics::ShapeId id,
Game::Entity entity )
static

True when a shape name held by a handle still names the shape its entity built.

◆ ShapeColliderType()

Physics::ColliderType PhysicsFeature::ShapeColliderType ( physx::PxShape const * pxShape)
static

Converts from pxshape to our internal collider type enum.

◆ WriteKinematicRigidbody()

void PhysicsFeature::WriteKinematicRigidbody ( Game::World * world,
Game::Entity entity,
PhysicsFeature::Rigidbody const & body,
Game::Position const & position,
Game::Orientation const & orientation,
PhysicsFeature::PhysicsActor const & handle )