Base component for physics-enabled items with world unit support. More...
| Import Statement: | import Clayground.Physics |
PhysicsItem provides the foundation for all physics-enabled components, handling bidirectional coordinate synchronization between world units and screen pixels, and wrapping a Box2D Body.
Example usage:
import Clayground.Physics import Box2D PhysicsItem { xWu: 5; yWu: 10 widthWu: 2; heightWu: 1 pixelPerUnit: 50 bodyType: Body.Dynamic }
Conversion factor between pixels and world units.
X position in world units.
Y position in world units.
Width in world units.
Height in world units.
The Box2D body instance.
Physics world reference. Auto-detected if physicsWorld exists in context.
Linear motion damping coefficient.
Angular motion damping coefficient.
Body type: Body.Static, Body.Kinematic, or Body.Dynamic.
Enable continuous collision detection for fast-moving objects.
Whether the body can sleep when inactive.
Prevent the body from rotating.
Whether the body is active in the physics simulation.
Whether the body is awake (not sleeping).
Linear velocity vector (x, y).
Angular velocity in radians per second.
List of fixtures attached to this body.
Gravity effect multiplier for this body.