MAV with Tokamak in a very simple program
Blitz3D Forums/Blitz3D Userlibs/MAV with Tokamak in a very simple program
| ||
I'm getting a MAV at the TOKSIM_Advance() command, but only occasionally. I've never once had Stunt Race MAV, and it's creating and destroying physics objects all over the place as the cars respawn, but with this very simple program I keep getting this MAV. The program is creating a few objects, letting them tumble around for a bit, then erasing them when their life counter runs out. To create them I'm using this: o\TOK_RB = TOKRB_Create() o\TOK_GEOM = TOKRB_AddBox( o\TOK_RB , sx# , sy# , sz# ) TOKGEOM_SetMaterialIndex o\TOK_GEOM , 1 TOKRB_SetMass o\TOK_RB , mass# TOKRB_SetBoxInertiaTensor o\TOK_RB , sx# , sy# , sz# , mass# TOKRB_SetLinearDamping o\TOK_RB , 0.0002 TOKRB_SetAngularDamping o\TOK_RB , 0.001 TOKRB_SetPosition o\TOK_RB , x# , y# , z# TOKRB_SetRotation o\TOK_RB , pitch# , yaw# , roll# and to remove them: TOKRB_Free o\TOK_RB o\TOK_RB = 0 o\TOK_GEOM = 0 Delete o Seemed simple enough. However it MAVs perhaps once every few hundred runs. I've just tried adding this to the remove section... TOKRB_RemoveGeometry o\TOK_RB , o\TOK_GEOM TOKRB_Active o\TOK_RB , False ...but the MAV is so infrequent that I've no way to check it's made any difference. I've run out of ideas now - anyone have any guess as to what might cause a MAV at the TOKSIM_Advance() command? |
| ||
Theres a bug in the underlying tokamak library/API related to deleting bodies - where other bodies reference the deleted object somehow on their next move... the only solution is to move physics objects outside of the gameworld i.e. 65536,65536,65536 in the frame before deleting... which is a messy hack and can have all kinds of unintended consequences not the least the logistics of moving the object in the first place. Personally I'd forget tok and license JVODE - although I've managed to get a few stack overflows with that too :D but that was trying some pretty extreme stuff. |