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, PxBVHStructure bvhStructure)
      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

    • 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

      @Deprecated public int getMaxNbActors()
      Deprecated.
      Retrieves max amount of actors that can be contained in the aggregate.

      Note: PxAggregate now supports an arbitrary number of actors. This method return PX_MAX_U32 and will be removed in a future release.

      Returns:
      Max actor 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