Class DefaultPhysicsSpace<T>

Type Parameters:
T -
All Implemented Interfaces:
ContinuousSpace<T>, PhysicsSpace<T>, Projection<T>
Direct Known Subclasses:
ContextPhysics

public class DefaultPhysicsSpace<T> extends DefaultContinuousSpace<T> implements PhysicsSpace<T>
A special 3-dimensional subclass of continuous space that determines the positions of agents based on physics.
Author:
Eric Tatara
  • Field Details

    • collisionConfiguration

      protected com.bulletphysics.collision.dispatch.CollisionConfiguration collisionConfiguration
    • dispatcher

      protected com.bulletphysics.collision.dispatch.CollisionDispatcher dispatcher
    • solver

      protected com.bulletphysics.dynamics.constraintsolver.SequentialImpulseConstraintSolver solver
    • dynamicsWorld

      protected com.bulletphysics.dynamics.DiscreteDynamicsWorld dynamicsWorld
    • bodyToObjectMap

      protected HashMap<com.bulletphysics.dynamics.RigidBody,T> bodyToObjectMap
    • objectToBodyMap

      protected HashMap<T,com.bulletphysics.dynamics.RigidBody> objectToBodyMap
    • stepSize

      protected float stepSize
    • maxSubSteps

      protected int maxSubSteps
  • Constructor Details

    • DefaultPhysicsSpace

      public DefaultPhysicsSpace(String name, ContinuousAdder<T> adder, PointTranslator translator, double xdim, double ydim, double zdim)
      Constructs this space with the specified name, adder, translator, and size.
      Parameters:
      name - the name of the space
      adder - the adder used by the space
      translator - the point translator
      xdim - the size of the x dimension
      ydim - the size of the y dimension
      zdim - the size of the z dimension
    • DefaultPhysicsSpace

      public DefaultPhysicsSpace(String name, ContinuousAdder<T> adder, PointTranslator translator, double[] size, double[] origin)
      Constructs this space with the specified name, adder, translator, size and origin.
      Parameters:
      name - the name of the space
      adder - the adder used by the space
      translator - the point translator
      size - the dimensions of the space
      origin - the origin of the space
  • Method Details

    • initPhysics

      protected void initPhysics(boolean scheduleStep)
    • addObject

      public boolean addObject(T object, com.bulletphysics.dynamics.RigidBody body)
      Specified by:
      addObject in interface PhysicsSpace<T>
    • getTransformForObject

      public com.bulletphysics.linearmath.Transform getTransformForObject(T object)
      Specified by:
      getTransformForObject in interface PhysicsSpace<T>
    • step

      public void step()
      Description copied from interface: PhysicsSpace
      Manually step the physics space dynamics
      Specified by:
      step in interface PhysicsSpace<T>
    • setLinearVelocity

      public void setLinearVelocity(T object, float x, float y, float z)
      Specified by:
      setLinearVelocity in interface PhysicsSpace<T>
    • getLinearVelocity

      public float[] getLinearVelocity(T object)
      Specified by:
      getLinearVelocity in interface PhysicsSpace<T>
    • setGravity

      public void setGravity(float x, float y, float z)
      Specified by:
      setGravity in interface PhysicsSpace<T>
    • getGravity

      public float[] getGravity()
      Specified by:
      getGravity in interface PhysicsSpace<T>
    • getStepSize

      public float getStepSize()
      Specified by:
      getStepSize in interface PhysicsSpace<T>
    • setStepSize

      public void setStepSize(float stepSize)
      Specified by:
      setStepSize in interface PhysicsSpace<T>
    • getMaxSubSteps

      public int getMaxSubSteps()
      Specified by:
      getMaxSubSteps in interface PhysicsSpace<T>
    • setMaxSubSteps

      public void setMaxSubSteps(int maxSubSteps)
      Specified by:
      setMaxSubSteps in interface PhysicsSpace<T>