Basics
Guides
API Reference
Basics
Guides
API Reference
[22:7] extends: FxObj
Wraps jbox2d's BodyDef (com.almasb.fxgl.physics.box2d.dynamics.BodyDef), the blueprint passed to World.createBody. Holds all the data needed to construct a rigid body: type, position, angle, linear / angular velocity, damping, sleep flags, fixed rotation, bullet hint, gravity scale, and user data. Fields are public Kotlin properties so the wrapper exposes paired getters / setters that go through getField / setField on the underlying AJO.
BodyDef ()
Creates a new BodyDef with jbox2d defaults (STATIC).
adopt (object Ajo)
Wraps an existing BodyDef AussomJavaObject.
getType ()
Returns the body type enum AJO.
setType (object TypeAjo)
Sets the body type from a BodyType enum AJO.
TypeAjo is a BodyType enum AJO (use BodyType.STATIC() etc, or BodyType.get("STATIC")).setTypeByName (string Name)
Sets the body type by name.
Name is "STATIC", "KINEMATIC", or "DYNAMIC".getPosition ()
Returns the position as a Vec2 wrapper.
setPosition (object VecObj)
Sets the position from a Vec2 wrapper.
getAngle ()
setAngle (double Angle)
getLinearVelocity ()
Returns the linear velocity as a Vec2 wrapper.
setLinearVelocity (object VecObj)
getAngularVelocity ()
setAngularVelocity (double V)
getLinearDamping ()
setLinearDamping (double V)
getAngularDamping ()
setAngularDamping (double V)
isAllowSleep ()
setAllowSleep (bool V)
isAwake ()
setAwake (bool V)
isFixedRotation ()
setFixedRotation (bool V)
isBullet ()
setBullet (bool V)
isActive ()
setActive (bool V)
getGravityScale ()
setGravityScale (double V)
getUserData ()
Returns the user data AJO (or null).
setUserData (Data)

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