Interface PhysicsLinkable

All Known Implementing Classes:
AnimatedSprite, Sprite

public interface PhysicsLinkable

Implemented by anything a PhysicsBody can drive -- typically a com.codename1.gaming.Sprite. After PhysicsWorld#step(float) integrates the simulation, the world pushes each body's transform into its linked object through this interface, converting from physics meters to screen pixels and flipping the y axis so the linked object stays in screen coordinates.

Keeping the binding to this minimal interface (rather than a concrete Sprite) lets the physics package stay independent of the sprite/rendering layer.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    setPhysicsPosition(float xPx, float yPx)
    Sets the object's position from the body center, in pixels.
    void
    setPhysicsRotation(float radians)
    Sets the object's rotation from the body, in radians (clockwise positive in screen space).
  • Method Details

    • setPhysicsPosition

      void setPhysicsPosition(float xPx, float yPx)
      Sets the object's position from the body center, in pixels.
    • setPhysicsRotation

      void setPhysicsRotation(float radians)
      Sets the object's rotation from the body, in radians (clockwise positive in screen space).