WorldPhysicsBodyEntries ( world )
Parameters
| world - loaded authored world handle |
Description
Returns a JSON array of live authored physics bodies. Each entry has
entityId (the resolved runtime entity ID), bodyId, and
reference (the authored body selector). The selector contains
entity and body; a prefab part also has an
instances array from the outer placement to the nested placement.
Use entityId and bodyId with
WorldPhysicsBody. Preserve
reference when writing a scene joint so its prefab path survives
save and reload. The array is empty until the world is ready. Free the JSON
handle with FreeJson.
Requires Extended mode.
|
; WorldPhysicsBodyEntries Example
; -------------------------------
; Requires Extended mode.
Graphics3D 640,480,0,2
scene=LoadWorldAsync("../../../samples/physics/physics-showcase.world")
While WorldReady(scene)=0
If WorldLoadState(scene)=WORLD_LOAD_FAILED Then RuntimeError WorldLoadError(scene)
UpdateAsyncLoads 2
Wend
entries=WorldPhysicsBodyEntries(scene)
For index=0 To JsonCount(entries)-1
entry=JsonArrayGet(entries,index)
entityId=JsonObjectGet(entry,"entityId")
bodyId=JsonObjectGet(entry,"bodyId")
Print JsonText(entityId)+" / "+JsonText(bodyId)
FreeJson bodyId:FreeJson entityId:FreeJson entry
Next
FreeJson entries
FreeWorld scene
End