public interface PhysicsLinkable

Known subtypesAnimatedSprite, Sprite

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.

Methods

public abstract void setPhysicsPosition(float xPx, float yPx)Sets the object’s position from the body center, in pixels.
public abstract void setPhysicsRotation(float radians)Sets the object’s rotation from the body, in radians (clockwise positive in screen space).

Method details

setPhysicsPosition

public abstract void setPhysicsPosition(float xPx, float yPx)
Sets the object’s position from the body center, in pixels.

setPhysicsRotation

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