lua.box3d.body.aabb
xa,ya,xb,yb = body:aabb()
Get body aabb as stream of numbers, lower bounds first then upper.
Note this value has to be calculated.
lua.box3d.body.acceleration
body:acceleration()
body:acceleration(x,y)
body:acceleration(x,y,r)
body:acceleration(nil,nil,r)
set body acceleration, which is to say we set the body force multiplied by mass or rotational inertia. Note that this will not work on a 0 mass body, I think you have to fake a mass on a body with no shapes first.
x,y is acceleration per second applied to center mass, will be cleared if nil
r is rotational acceleration per second in radians , will be cleared if nil
This will replace force and acceleration and as force is applied then cleared during a step, this needs to be set for every step.
lua.box3d.body.awake
b = body:awake()
b = body:awake(b)
get/set body sleeping state.
lua.box3d.body.convert
x,y = body:convert(x,y,conversion)
conversion must be one of the following strings indicating how the input x,y should be transformed into the output x,y
x,y = body:convert(x,y,"point_local_to_world")
x,y = body:convert(x,y,"point_world_to_local")
x,y = body:convert(x,y,"vector_local_to_world")
x,y = body:convert(x,y,"vector_world_to_local")
x,y = body:convert(x,y,"point_local_to_velocity")
x,y = body:convert(x,y,"point_world_to_velocity")
convert x,y between various spaces.
lua.box3d.body.destroy
body:destroy()
Destroy the body and all sub objects (shapes)
lua.box3d.body.force
body:force()
body:force(x,y)
body:force(x,y,r)
body:force(nil,nil,r)
set body force , note that this does not return the current force and calling it without any values will clear the current force.
x,y is force applied to center mass, will be cleared if nil
r is torque , will be cleared if nil
This will replace force and acceleration and as force is applied then cleared during a step, this needs to be set for every step.
lua.box3d.body.get
vars = body:get()
Get all body variables in a table.
lua.box3d.body.info
info = body:info()
This returns the def table used to create the body along with as much updated information as we have available, mostly intended as a debugging aid.
This is the actual def table (some values are hard to query later) so if you edit it or if you create this object using a non unique def table things can get strange.
lua.box3d.body.mass
mass , rotationalInertia , x,y = body:mass( mass , rotationalInertia , x,y )
mass = ( body:mass(mass) )
get/set mass values, all values are optional but x,y must be a pair. Unset values will remain unchanged.
x,y is center of mass
We return 4 values but as the first one is mass you can simply ignore the rest by wrapping the function in ()
Since adding shapes will auto generate these values, be aware that you will be fighting auto mass generation when setting this value.
Adding shapes or changing the body type will auto generate these values.
lua.box3d.body.set
body:set(vars)
Set all body variables from a table.
lua.box3d.body.transform
x,y,r = body:transform()
x,y,r = body:transform(x,y,r)
get/set body transform
lua.box3d.body.type
btype = body:type()
btype = body:type(btype)
get/set body type. btype is a string, Possible values are
static
kinematic
dynamic
lua.box3d.body.velocity
x,y,r = body:velocity()
x,y,r = body:velocity(x,y,r)
get/set body velocity