JV-ODE Physics Thread 3

Blitz3D Forums/Blitz3D Userlibs/JV-ODE Physics Thread 3

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Type are ideal for ODE, as you can package all the related objects together into one type. The standard is to have your Blitz mesh, ODE body and ODE geom objects all in a type...

TYPE ODE_object
Field geom
Field body
Field mesh
END TYPE

Then you can reference the object for related activities. eg. Turn make an inactive object invisible
Dim Objects.ODE_object(10)

FOR n = 0 TO 10
   IF NOT dBodyIsEnabled(Objects(n)\body)
      HideEntity(Objects(n)\mesh)
   ENDIF
NEXT

With all your bodies, geoms and meshes grouped together this way, you can easily reference the different parts to an objects with the same index (if they're in an array). Or as in my case create a linked list where you can add and remove objects at will.

Without using types you make keeping tabs on your object's activities and making one thing respond to another thing much more complicated IMO.