Actor

From Esenthel

Jump to: navigation, search

Actor is a physical object.


It contains following parameters:

  • shape
  • position
  • orientation
  • velocity
  • angular velocity
  • mass
  • physical material
  • user data (pointer to custom data)
  • pointer to custom object containing the actor


Shape of an actor can be of following type:

  • based on simple geometric shape (box, sphere, capsule, tube)
  • based on convex mesh made from triangles or quads (Convex type)
  • based on any mesh made from triangles or quads (Mesh type)


There are following definitions:

  • Static Actor - stationary actor, it doesn't move or rotate. It can be moved manually, however these operations shouldn't be called frequently because they require performing additional calculations. Static actor is created by giving a mass density of zero. Example of a static actor - building.
  • Kinematic Actor - actor mostly stationary - it doesn't move or rotate by itself, however it can be moved manually. In order to achieve smooth movement it is encouraged to call each frame Actor::kinematicMoveTo method. Kinematic actor is created by giving a mass density different from zero, and enabling actor's 'kinematic' option to true. Example of a kinematic actor - manually controlled elevator, platform.
  • Dynamic Actor - actor which moves and rotates automatically according to collisions with other actors. Actor can be moved or rotated manually, however for the most realistic simulation it is encouraged to apply velocites instead. Dynamic actor is created by giving a mass density different from zero, and leaving the 'kinematic' option to false. Example of a dynamic actor - mobile item.


Managing actors:

  • The best way to create an actor is to use already prepared Physical Bodies in Mesh Editor, or using simple geometric shape.
  • Actor can be dynamically changed from Kinematic Actor to Dynamic Actor and vice versa, by using Actor::kinematic method.
  • Any actor can be disabled from physics simulation by using Actor::active method, through disabled actor other objects will move as if it wasn't there.


PhysX limitations:

  • All 'sweep' methods (testing if an actor hits any shape in desired direction) don't work on Mesh or Convex type actors.
  • Actors of Mesh type cannot be dynamic, in other words they can only be static.
  • PhysX supports only up to 64k actor shapes on the scene, please note that one actor can be made out of more than one shape and each shape counts.


Taking those limitations and physics calculation speed in mind, it's encouraged to:

  • for dynamic actors, using shapes based on simple geometric shapes, use Convex only when necessary.
  • for static actors, if a shape isn't too complicated use simple geometric shapes, in other case use Convex or Mesh types.


Actors in world when using World Manager:

  • When using Actors in World, they must have their 'Actor::obj' pointer set to object (Game::Obj) which contains the actor.
  • Built in Object Classes automatically set this pointer, however you need to set it manually when creating custom actors in other classes.
Personal tools