Basics
Guides
API Reference
Basics
Guides
API Reference
[16:7] extends: Component
Wraps FXGL's PhysicsComponent, the jbox2d-backed component that gives an Entity dynamics (mass, friction, restitution, gravity, linear and angular velocity, impulses, forces). Attach with entity.addComponent before adding the entity to a GameWorld; the physics body is created on the first physics tick after the entity is added.
PhysicsComponent ()
Creates a new PhysicsComponent. Defaults to a static body type; call setBodyType("DYNAMIC") to make it movable.
adopt (object Ajo)
Wraps an existing PhysicsComponent AussomJavaObject.
Ajo is an AussomJavaObject around a PhysicsComponent.A new wrapper.setBodyType (string TypeName)
Sets the body type: "STATIC" (immovable), "KINEMATIC" (moved by velocity but not affected by forces), or "DYNAMIC" (full physics simulation).
TypeName is the body type name.this objectsetLinearVelocity (double X, double Y)
Sets the linear velocity in pixels per second.
X is the X velocity.Y is the Y velocity.this objectsetVelocityX (double X)
Sets just the X linear velocity.
X is the X velocity.this objectsetVelocityY (double Y)
Sets just the Y linear velocity.
Y is the Y velocity.this objectgetVelocityX ()
Returns the X linear velocity.
A double.getVelocityY ()
Returns the Y linear velocity.
A double.setAngularVelocity (double Velocity)
Sets the angular velocity in radians per second.
Velocity is the angular velocity.this objectisOnGround ()
Returns whether this entity's body is currently grounded (touching another collidable below).
A bool.isMovingX ()
Returns whether the entity is moving horizontally.
A bool.isMovingY ()
Returns whether the entity is moving vertically.
A bool.isMoving ()
Returns whether the entity is moving in any direction.
A bool.onPhysicsInitialized (callback Cb)
Registers a callback that runs once the body has been created in the physics world (after the first physics tick following entity-add). Use this to set velocity or apply impulses on a dynamic body at spawn -- calls made before the body exists are silently lost otherwise.
Cb is a callback with no arguments.this objectsetDensity (double Density)
Sets the fixture density. Required for dynamic bodies to have mass and respond properly to forces. Convenience that builds a FixtureDef internally; reset by any subsequent setDensityFriction call.
Density is the density value (units per area).this objectsetDensityFriction (double Density, double Friction)
Sets the fixture density and friction together.
Density is the density value.Friction is the friction coefficient (0.0 to 1.0).this objectsetDensityFrictionRestitution (double Density, double Friction, double Restitution)
Sets density, friction, and restitution (bounciness) on the fixture in one call.
Density is the density value.Friction is the friction coefficient (0.0 to 1.0).Restitution is the restitution coefficient (0.0 = no bounce, 1.0 = elastic).this objectapplyLinearImpulse (double Ix, double Iy, double Px, double Py, bool Wake = true)
Applies an instantaneous linear impulse to the body at the given point. The most common way to give a dynamic body a one-shot velocity change (e.g. firing a cannonball).
Ix is the X impulse.Iy is the Y impulse.Px is the application point X.Py is the application point Y.Wake selects whether to wake the body if asleep.this objectapplyForce (double Fx, double Fy, double Px, double Py)
Applies a continuous force to the body at the given point. Use for thrust, wind, or other ongoing forces.
Fx is the X force.Fy is the Y force.Px is the application point X.Py is the application point Y.this objectapplyForceToCenter (double Fx, double Fy)
Applies a continuous force to the body's center of mass.
Fx is the X force.Fy is the Y force.this objectoverwritePosition (double X, double Y)
Teleports the body to the given world position. Use for level resets and respawn -- normal setPosition on the entity is ignored once a dynamic body is active.
X is the new X.Y is the new Y.this objectoverwriteAngle (double Degrees)
Teleports the body's rotation to the given angle in degrees.
Degrees is the new rotation.this objectgetLinearVelocity ()
Returns the linear velocity as an AussomJavaObject around a Point2D. Read components via .invoke("getX") / .invoke("getY").
An AussomJavaObject around a Point2D.addGroundSensor (object HitBoxObj)
Adds a ground sensor (a hit box that detects contact below the body). isOnGround returns true while the sensor is in contact with another fixture.
HitBoxObj is an AussomJavaObject around a HitBox.this objectaddSensor (object HitBoxObj, object HandlerObj)
Adds a sensor with a custom collision handler. The sensor fires the handler's onCollisionBegin / End callbacks but does not participate in physics resolution.
HitBoxObj is an AussomJavaObject around a HitBox.HandlerObj is an AussomJavaObject around a SensorCollisionHandler.this objectremoveSensor (object HitBoxObj)
Removes a sensor previously added via addSensor or addGroundSensor.
HitBoxObj is the HitBox AussomJavaObject originally passed to addSensor.this objectsetRaycastIgnored (bool Ignored)
Marks this entity as ignored by raycast queries.
Ignored is a bool.this objectisRaycastIgnored ()
Returns whether this entity is ignored by raycast queries.
A bool.getBody ()
Escape hatch returning the underlying jbox2d Body as an AussomJavaObject. Use this when something deeper than the wrapper exposes is needed (custom contact filters, iterating fixtures, body-level transforms).
An AussomJavaObject around the jbox2d Body. Throws IllegalStateException if called before the engine creates the body (i.e. before the first physics tick).applyBodyForce (object ForceVec, object PointVec)
Applies a body-space linear force at a body-space point. Uses Vec2 wrappers (Box2D-space units), distinct from applyForce which uses Point2D pixels.
applyBodyForceToCenter (object ForceVec)
Applies a body-space linear force at the center of mass.
applyBodyLinearImpulse (object ImpulseVec, object PointVec, bool Wake)
Applies a body-space linear impulse at a body-space point.
ImpulseVec is a Vec2 wrapper.PointVec is a Vec2 wrapper.Wake is true to wake the body if asleep.setBodyLinearVelocity (object VelVec)
Sets the body-space linear velocity from a Vec2 wrapper.
setBodyDef (object DefObj)
Sets the BodyDef used to create the underlying body. Must be called before the engine instantiates the body.
DefObj is a BodyDef wrapper.setFixtureDef (object DefObj)
Sets the FixtureDef used to create the body's primary fixture. Must be called before body creation.
DefObj is a FixtureDef wrapper.setOnPhysicsInitialized (callback Cb)
Registers a Runnable invoked once after the engine has created the underlying body. Use to safely access getBody().
Cb is a callback () -> any.onGroundProperty ()
Returns the on-ground ReadOnlyBooleanProperty for binding.
getSensorHandlers ()
Returns the (HitBox -> SensorCollisionHandler) map as an AJO.

Aussom
Write once. Embed everywhere.
Copyright 2026 Austin Lehman. All rights reserved.