Nebula
Loading...
Searching...
No Matches
Physics::ActorContext Class Reference

#include <actorcontext.h>

Public Types

enum  { DefaultShapeAlloc = 16 }
using ShapeArrayType = Util::StackArray<ShapeHandle, DefaultShapeAlloc>

Static Public Member Functions

static ActorId CreateBox (Math::vector const &extends, IndexT material, ActorType type, Math::mat4 const &transform, IndexT scene=0)
 helper functions for creating shapes
static ActorId CreateSphere (float radius, IndexT material, ActorType type, Math::mat4 const &transform, IndexT scene=0)
static ActorId CreatePlane (Math::plane const &plane, IndexT material, IndexT scene=0)
static ActorId CreateCapsule (float radius, float halfHeight, IndexT material, ActorType type, Math::mat4 const &transform, IndexT scene=0)
static ActorId CreateConvexHull (float *vertices, int numVertices, IndexT material, ActorType type, Math::mat4 const &transform, IndexT scene=0)
 Create a convex hull/mesh from vertex buffer.
static Actor & GetActor (ActorId id)
static void SetTransform (ActorId id, Math::mat4 const &transform)
static Math::mat4 GetTransform (ActorId id)
static void SetPositionOrientation (ActorId id, Math::vec3 const &position, Math::quat const &orientation)
static void GetPositionOrientation (ActorId id, Math::vec3 &position, Math::quat &orientation)
static void SetLinearVelocity (ActorId id, Math::vector speed)
static Math::vector GetLinearVelocity (ActorId id)
static void SetAngularVelocity (ActorId id, Math::vector speed)
static Math::vector GetAngularVelocity (ActorId id)
static void ApplyImpulseAtPos (ActorId id, const Math::vector &impulse, const Math::point &pos)
 apply a global impulse vector at the next time step at a global position
static void SetCollisionFeedback (ActorId id, CollisionFeedback feedback)
 modify collision callback handling
static SizeT GetShapeCount (ActorId id)
static void GetShapes (ActorId id, ShapeArrayType &shapes)
static Math::transform GetShapeTransform (const ShapeHandle &shape)
static void SetShapeTransform (const ShapeHandle &shape, const Math::transform &transform)
static ActorId CreateActor (const BodyDescription &desc)
 Create a body from plain data. Shapes are added separately with AddShape.
static void UpdateBody (ActorId id, const BodyDescription &desc)
 apply the body properties of the description onto an existing actor
static ShapeId AddShape (ActorId actor, const ColliderDescription &desc)
 add a shape to an actor
static bool UpdateShape (ShapeId shape, const ColliderDescription &desc)
 apply a description onto an existing shape. The geometry is rebuilt if the shape parameters changed
static void RemoveShape (ShapeId shape)
 detach and release a shape from its actor
static Shape & GetShape (ShapeId id)
static bool IsValidShape (ShapeId id)
static physx::PxRigidActor * GetPxActor (ActorId id)
 shortcut for getting the pxactor object
static physx::PxRigidDynamic * GetPxDynamic (ActorId id)
 shortcut for getting the pxactor object
static bool IsValid (ActorId id)
static void DiscardActor (ActorId id)
 destroy an actor and the shapes it owns

Static Private Member Functions

static ActorId AllocateActorId (physx::PxRigidActor *pxActor)
static ActorId AllocateActorId (physx::PxRigidActor *pxActor, ActorResourceId res)
static ShapeId AllocateShapeId (physx::PxShape *pxShape, ActorId actor, uint64_t geometryHash, uint64_t userData)

Static Private Attributes

static Util::Array< Actor > actors
static Ids::IdGenerationPool actorPool
static Util::Array< Shape > shapes
static Ids::IdGenerationPool shapePool

Friends

class PhysxState
class StreamActorPool

Member Typedef Documentation

◆ ShapeArrayType

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
DefaultShapeAlloc 

Member Function Documentation

◆ AddShape()

ShapeId Physics::ActorContext::AddShape ( ActorId actor,
const ColliderDescription & desc )
static

add a shape to an actor

◆ AllocateActorId() [1/2]

ActorId Physics::ActorContext::AllocateActorId ( physx::PxRigidActor * pxActor)
staticprivate

◆ AllocateActorId() [2/2]

ActorId Physics::ActorContext::AllocateActorId ( physx::PxRigidActor * pxActor,
ActorResourceId res )
staticprivate

◆ AllocateShapeId()

ShapeId Physics::ActorContext::AllocateShapeId ( physx::PxShape * pxShape,
ActorId actor,
uint64_t geometryHash,
uint64_t userData )
staticprivate

◆ ApplyImpulseAtPos()

void Physics::ActorContext::ApplyImpulseAtPos ( ActorId id,
const Math::vector & impulse,
const Math::point & pos )
static

apply a global impulse vector at the next time step at a global position

◆ CreateActor()

ActorId Physics::ActorContext::CreateActor ( const BodyDescription & desc)
static

Create a body from plain data. Shapes are added separately with AddShape.

◆ CreateBox()

ActorId Physics::ActorContext::CreateBox ( Math::vector const & extends,
IndexT material,
ActorType type,
Math::mat4 const & transform,
IndexT scene = 0 )
static

helper functions for creating shapes

◆ CreateCapsule()

ActorId Physics::ActorContext::CreateCapsule ( float radius,
float halfHeight,
IndexT material,
ActorType type,
Math::mat4 const & transform,
IndexT scene = 0 )
static

◆ CreateConvexHull()

ActorId Physics::ActorContext::CreateConvexHull ( float * vertices,
int numVertices,
IndexT material,
ActorType type,
Math::mat4 const & transform,
IndexT scene = 0 )
static

Create a convex hull/mesh from vertex buffer.

Assumes "xyz" points (sizeof(float) * 3).

Note
You should consider cooking the hulls offline. This is relatively fast for real-time generation of convex hulls, but won't yield as accurate results as offline.

◆ CreatePlane()

ActorId Physics::ActorContext::CreatePlane ( Math::plane const & plane,
IndexT material,
IndexT scene = 0 )
static

◆ CreateSphere()

ActorId Physics::ActorContext::CreateSphere ( float radius,
IndexT material,
ActorType type,
Math::mat4 const & transform,
IndexT scene = 0 )
static

◆ DiscardActor()

void Physics::ActorContext::DiscardActor ( ActorId id)
static

destroy an actor and the shapes it owns

◆ GetActor()

Actor & Physics::ActorContext::GetActor ( ActorId id)
static

◆ GetAngularVelocity()

Math::vector Physics::ActorContext::GetAngularVelocity ( ActorId id)
static

◆ GetLinearVelocity()

Math::vector Physics::ActorContext::GetLinearVelocity ( ActorId id)
static

◆ GetPositionOrientation()

void Physics::ActorContext::GetPositionOrientation ( ActorId id,
Math::vec3 & position,
Math::quat & orientation )
static

◆ GetPxActor()

physx::PxRigidActor * Physics::ActorContext::GetPxActor ( ActorId id)
static

shortcut for getting the pxactor object

◆ GetPxDynamic()

physx::PxRigidDynamic * Physics::ActorContext::GetPxDynamic ( ActorId id)
static

shortcut for getting the pxactor object

◆ GetShape()

Shape & Physics::ActorContext::GetShape ( ShapeId id)
static

◆ GetShapeCount()

SizeT Physics::ActorContext::GetShapeCount ( ActorId id)
static

◆ GetShapes()

void Physics::ActorContext::GetShapes ( ActorId id,
ShapeArrayType & shapes )
static

◆ GetShapeTransform()

Math::transform Physics::ActorContext::GetShapeTransform ( const ShapeHandle & shape)
static

◆ GetTransform()

Math::mat4 Physics::ActorContext::GetTransform ( ActorId id)
static

◆ IsValid()

bool Physics::ActorContext::IsValid ( ActorId id)
inlinestatic

◆ IsValidShape()

bool Physics::ActorContext::IsValidShape ( ShapeId id)
inlinestatic

◆ RemoveShape()

void Physics::ActorContext::RemoveShape ( ShapeId shape)
static

detach and release a shape from its actor

Detach and release a shape from its actor.

◆ SetAngularVelocity()

void Physics::ActorContext::SetAngularVelocity ( ActorId id,
Math::vector speed )
static

◆ SetCollisionFeedback()

void Physics::ActorContext::SetCollisionFeedback ( ActorId id,
CollisionFeedback feedback )
static

modify collision callback handling

◆ SetLinearVelocity()

void Physics::ActorContext::SetLinearVelocity ( ActorId id,
Math::vector speed )
static

◆ SetPositionOrientation()

void Physics::ActorContext::SetPositionOrientation ( ActorId id,
Math::vec3 const & position,
Math::quat const & orientation )
static

◆ SetShapeTransform()

void Physics::ActorContext::SetShapeTransform ( const ShapeHandle & shape,
const Math::transform & transform )
static

◆ SetTransform()

void Physics::ActorContext::SetTransform ( ActorId id,
Math::mat4 const & transform )
static

◆ UpdateBody()

void Physics::ActorContext::UpdateBody ( ActorId id,
const BodyDescription & desc )
static

apply the body properties of the description onto an existing actor

◆ UpdateShape()

bool Physics::ActorContext::UpdateShape ( ShapeId id,
const ColliderDescription & desc )
static

apply a description onto an existing shape. The geometry is rebuilt if the shape parameters changed

Apply a description onto an existing shape.

Physx shapes can not change their geometry, so when the geometry hash changes the shape is replaced by a newly cooked one. Returns false if the geometry could not be built.

◆ PhysxState

friend class PhysxState
friend

◆ StreamActorPool

friend class StreamActorPool
friend

Member Data Documentation

◆ actorPool

Ids::IdGenerationPool Physics::ActorContext::actorPool
staticprivate

◆ actors

Util::Array< Actor > Physics::ActorContext::actors
staticprivate

◆ shapePool

Ids::IdGenerationPool Physics::ActorContext::shapePool
staticprivate

◆ shapes

Util::Array< Shape > Physics::ActorContext::shapes
staticprivate

The documentation for this class was generated from the following files: