Package physx.physics

Class PxAggregate


public class PxAggregate extends PxBase
Class to aggregate actors into a single broad-phase entry.

A PxAggregate object is a collection of PxActors, which will exist as a single entry in the broad-phase structures. This has 3 main benefits:

1) it reduces "broad phase pollution" by allowing a collection of spatially coherent broad-phase entries to be replaced by a single aggregated entry (e.g. a ragdoll or a single actor with a large number of attached shapes).

2) it reduces broad-phase memory usage

3) filtering can be optimized a lot if self-collisions within an aggregate are not needed. For example if you don't need collisions between ragdoll bones, it's faster to simply disable filtering once and for all, for the aggregate containing the ragdoll, rather than filtering out each bone-bone collision in the filter shader.

See Also:
  • Field Details

    • SIZEOF

      public static final int SIZEOF
    • ALIGNOF

      public static final int ALIGNOF
      See Also:
  • Constructor Details

    • PxAggregate

      protected PxAggregate()
    • PxAggregate

      protected PxAggregate(long address)
  • Method Details

    • wrapPointer

      public static PxAggregate wrapPointer(long address)
    • arrayGet

      public static PxAggregate arrayGet(long baseAddress, int index)
    • addActor

      public boolean addActor(PxActor actor)
      Adds an actor to the aggregate object.

      A warning is output if the total number of actors is reached, or if the incoming actor already belongs to an aggregate.

      If the aggregate belongs to a scene, adding an actor to the aggregate also adds the actor to that scene.

      If the actor already belongs to a scene, a warning is output and the call is ignored. You need to remove the actor from the scene first, before adding it to the aggregate.

      Note: When a BVH is provided the actor shapes are grouped together. The scene query pruning structure inside PhysX SDK will store/update one bound per actor. The scene queries against such an actor will query actor bounds and then make a local space query against the provided BVH, which is in actor's local space.

      return true if success

    • addActor

      public boolean addActor(PxActor actor, PxBVH bvh)
      Adds an actor to the aggregate object.

      A warning is output if the total number of actors is reached, or if the incoming actor already belongs to an aggregate.

      If the aggregate belongs to a scene, adding an actor to the aggregate also adds the actor to that scene.

      If the actor already belongs to a scene, a warning is output and the call is ignored. You need to remove the actor from the scene first, before adding it to the aggregate.

      Note: When a BVH is provided the actor shapes are grouped together. The scene query pruning structure inside PhysX SDK will store/update one bound per actor. The scene queries against such an actor will query actor bounds and then make a local space query against the provided BVH, which is in actor's local space.

      return true if success

    • removeActor

      public boolean removeActor(PxActor actor)
      Removes an actor from the aggregate object.

      A warning is output if the incoming actor does not belong to the aggregate. Otherwise the actor is removed from the aggregate. If the aggregate belongs to a scene, the actor is reinserted in that scene. If you intend to delete the actor, it is best to call #PxActor::release() directly. That way the actor will be automatically removed from its aggregate (if any) and not reinserted in a scene.

      return true if success

    • addArticulation

      public boolean addArticulation(PxArticulationReducedCoordinate articulation)
      Adds an articulation to the aggregate object.

      A warning is output if the total number of actors is reached (every articulation link counts as an actor), or if the incoming articulation already belongs to an aggregate.

      If the aggregate belongs to a scene, adding an articulation to the aggregate also adds the articulation to that scene.

      If the articulation already belongs to a scene, a warning is output and the call is ignored. You need to remove the articulation from the scene first, before adding it to the aggregate.

      return true if success

    • removeArticulation

      public boolean removeArticulation(PxArticulationReducedCoordinate articulation)
      Removes an articulation from the aggregate object.

      A warning is output if the incoming articulation does not belong to the aggregate. Otherwise the articulation is removed from the aggregate. If the aggregate belongs to a scene, the articulation is reinserted in that scene. If you intend to delete the articulation, it is best to call #PxArticulationReducedCoordinate::release() directly. That way the articulation will be automatically removed from its aggregate (if any) and not reinserted in a scene.

      return true if success

    • getNbActors

      public int getNbActors()
      Returns the number of actors contained in the aggregate.

      You can use #getActors() to retrieve the actor pointers.

      Returns:
      Number of actors contained in the aggregate.
      See Also:
    • getMaxNbActors

      public int getMaxNbActors()
      Retrieves max amount of actors that can be contained in the aggregate.
      Returns:
      Max actor size.
    • getMaxNbShapes

      public int getMaxNbShapes()
      Retrieves max amount of shapes that can be contained in the aggregate.
      Returns:
      Max shape size.
    • getScene

      public PxScene getScene()
      Retrieves the scene which this aggregate belongs to.
      Returns:
      Owner Scene. NULL if not part of a scene.
      See Also:
    • getSelfCollision

      public boolean getSelfCollision()
      Retrieves aggregate's self-collision flag.
      Returns:
      self-collision flag