Class PhysicsBody

All Implemented Interfaces:
Behavior, Renderable, Closeable, AutoCloseable

public class PhysicsBody extends ComponentBehavior
  • Constructor Details

    • PhysicsBody

      public PhysicsBody()
  • Method Details

    • onCreate

      public void onCreate()
      Description copied from class: ComponentBehavior
      Called when the behavior is created.
      Overrides:
      onCreate in class ComponentBehavior
    • close

      public void close()
      Description copied from class: ComponentBehavior
      Called when the behavior is closed.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Overrides:
      close in class ComponentBehavior
    • applyForce

      public void applyForce(Vector2D force)
    • applyLinearImpulse

      public void applyLinearImpulse(Vector2D impulse)
    • applyTorque

      public void applyTorque(double torque)
    • linearVelocity

      public ImmutableVector2D linearVelocity()
    • setLinearVelocity

      public PhysicsBody setLinearVelocity(Vector2D linearVelocity)
    • applyAngularImpulse

      public void applyAngularImpulse(double impulse)
    • onUpdate

      public void onUpdate(ContextTime time)
      Description copied from class: ComponentBehavior
      Called every frame.
      Specified by:
      onUpdate in interface Behavior
      Overrides:
      onUpdate in class ComponentBehavior
      Parameters:
      time - The context time.
    • onLateUpdate

      public void onLateUpdate(ContextTime time)
      Description copied from class: ComponentBehavior
      Overrides:
      onLateUpdate in class ComponentBehavior
      Parameters:
      time - The context time.
    • addContactListener

      public void addContactListener(org.jbox2d.callbacks.ContactListener contactListener)
    • type

      public BodyType type()
    • setType

      public PhysicsBody setType(BodyType type)
    • b2Body

      public org.jbox2d.dynamics.Body b2Body()
    • setB2Body

      public PhysicsBody setB2Body(org.jbox2d.dynamics.Body b2Body)
    • linearDamping

      public double linearDamping()
    • setLinearDamping

      public PhysicsBody setLinearDamping(double linearDamping)
    • angularDamping

      public double angularDamping()
    • setAngularDamping

      public PhysicsBody setAngularDamping(double angularDamping)
    • allowSleep

      public boolean allowSleep()
    • setAllowSleep

      public PhysicsBody setAllowSleep(boolean allowSleep)
    • fixedRotation

      public boolean fixedRotation()
    • setFixedRotation

      public PhysicsBody setFixedRotation(boolean fixedRotation)
    • bullet

      public boolean bullet()
    • setBullet

      public PhysicsBody setBullet(boolean bullet)
    • gravityScale

      public double gravityScale()
    • setGravityScale

      public PhysicsBody setGravityScale(double gravityScale)
    • contactListeners

      public List<org.jbox2d.callbacks.ContactListener> contactListeners()