lua.box2d.world.defaults
cache=world:defaults(name)
cache=world:defaults(name,def)
Remember default values in the world cache, this is intended for generic body/shape/joint creation.
Returns the current def cache for the name.
The def table will be copied ( top level only ) into a cache of the given values adding or replacing them.
if def table is nil then the current cached values will be cleared.
For example to cache a constant density value ( because you changed the global units per meters )
world:defaults("shape",{density=1/256})
When shapes are created they will automatically use the "shape" cache to fill in missing values. Same for "body" and "joint" caches.
You can also use this to fill in special object defaults like so.
world:defaults("shape_bouncy",{material_restitution=1})
...
body:shape(world:fill({...},"shape_bouncy"))