First, be sure to make a call to TOK_SetMesh() after TOK_AddMesh().
Then the ID of a static mesh is -1. Do you have the utility functions from botBuilder (I think it's him). If not, take them from the last version of the tokamak wrapper.
Then I have added some useful functions for what you do: this check collision between all types of body in Tokamak. Here it is:
; This function returns true if a collision happens between the 2 given types
; type1 = type of 1st body
; type2 = type of 2nd body
; return = True if the 2 types have collided
Function TOKCOL_CheckCollision(index, type1%, type2%)
; Check the 2 possibilities
If TOKCOL_GetCollisionIdA(index) = type1 And TOKCOL_GetCollisionIdB(index) = type2 Then Return True
If TOKCOL_GetCollisionIdA(index) = type2 And TOKCOL_GetCollisionIdB(index) = type1 Then Return True
Return False
End Function
Function TOKCOL_GetCollisionIdA(index)
If TOKCOL_TypeA(index) = 0 Then Return -1
If TOKCOL_TypeA(index) = 1 Then Return TOKRB_GetCollisionID(TOKCOL_BodyA(index))
If TOKCOL_TypeA(index) = 2 Then Return TOKAB_GetCollisionID(TOKCOL_BodyA(index))
Return 0
End Function
Function TOKCOL_GetCollisionIdB(index)
If TOKCOL_TypeB(index) = 0 Then Return -1
If TOKCOL_TypeB(index) = 1 Then Return TOKRB_GetCollisionID(TOKCOL_BodyB(index))
If TOKCOL_TypeB(index) = 2 Then Return TOKAB_GetCollisionID(TOKCOL_BodyB(index))
Return 0
End Function
; Functions by BotBuilder (modified to use a global bank)
Function TOKCOL_bodyA(index)
Return PeekInt(collBank, index*104+0)
End Function
Function TOKCOL_bodyB(index)
Return PeekInt(collBank, index*104+4)
End Function
Function TOKCOL_TypeA(index)
Return PeekInt(collBank,index*104+8)
End Function
Function TOKCOL_TypeB(index)
Return PeekInt(collBank,index*104+12)
End Function
Function TOKCOL_GeometryA(index)
Return PeekInt(collBank,index*104+16)
End Function
Function TOKCOL_GeometryB(index)
Return PeekInt(collBank,index*104+20)
End Function
Function TOKCOL_MaterialIdA(index)
Return PeekInt(collBank,index*104+24)
End Function
Function TOKCOL_MaterialIdB(index)
Return PeekInt(collBank,index*104+28)
End Function
Function TOKCOL_BodyContactPointAX#(index)
Return PeekFloat(collBank,index*104+32)
End Function
Function TOKCOL_BodyContactPointAY#(index)
Return PeekFloat(collBank,index*104+36)
End Function
Function TOKCOL_BodyContactPointAZ#(index)
Return PeekFloat(collBank,index*104+40)
End Function
Function TOKCOL_BodyContactPointBX#(index)
Return PeekFloat(collBank,index*104+44)
End Function
Function TOKCOL_BodyContactPointBY#(index)
Return PeekFloat(collBank,index*104+48)
End Function
Function TOKCOL_BodyContactPointBZ#(index)
Return PeekFloat(collBank,index*104+52)
End Function
Function TOKCOL_WorldContactPointAX#(index)
Return PeekFloat(collBank,index*104+56)
End Function
Function TOKCOL_WorldContactPointAY#(index)
Return PeekFloat(collBank,index*104+60)
End Function
Function TOKCOL_WorldContactPointAZ#(index)
Return PeekFloat(collBank,index*104+64)
End Function
Function TOKCOL_WorldContactPointBX#(index)
Return PeekFloat(collBank,index*104+68)
End Function
Function TOKCOL_WorldContactPointBY#(index)
Return PeekFloat(collBank,index*104+72)
End Function
Function TOKCOL_WorldContactPointBZ#(index)
Return PeekFloat(collBank,index*104+76)
End Function
Function TOKCOL_RelativeVelocityX#(index)
Return PeekFloat(collBank,index*104+80)
End Function
Function TOKCOL_RelativeVelocityY#(index)
Return PeekFloat(collBank,index*104+84)
End Function
Function TOKCOL_RelativeVelocityZ#(index)
Return PeekFloat(collBank,index*104+88)
End Function
Function TOKCOL_CollisionNormalX#(index)
Return PeekFloat(collBank,index*104+92)
End Function
Function TOKCOL_CollisionNormalY#(index)
Return PeekFloat(collBank,index*104+96)
End Function
Function TOKCOL_CollisionNormalZ#(index)
Return PeekFloat(collBank,index*104+100)
End Function
Example of use (don't forget that a static ID is -1) :
;****************************************
;*** Somewhere in your initialisation ***
;****************************************
Const TYPE_STATIC = -1 ; Collision type for the static mesh
Const TYPE_BALL = 2 ; Collision type for the ball
; When you define your RB (or AB with TOKAB_SetCollisionID)
TOKRB_SetCollisionID ball\rb, TYPE_BALL
; Definition of your bank for collision
; Warning: do not put a too small value for nbCollMax!
nbCollMax = 100
global CollBank = CreateBank(104*NbCollMax)
TOKSIM_SetCInfoBank(CollBank)
; Response values:
; 0 = No impulse or feedback
; 1 = Impulse only
; 2 = Feedback only
; 3 = Impulse & Feedback
; Caution: put the 2 possibilities (vice and versa) !
TOKSIM_SetCollisionResponse TYPE_STATIC, TYPE_BALL, 3
TOKSIM_SetCollisionResponse TYPE_BALL, TYPE_STATIC, 3
;*************************************
;*** In your main loop, simply do: ***
;*************************************
If TOKSIM_GetCollisionCount() > 0 Then
For iColl = 0 To TOKSIM_GetCollisionCount() - 1
If (TOKCOL_CheckCollision(iColl, TYPE_BALL, TYPE_STATIC) = True Then
blah blah
endif
next
endif
That should work! Tell me if it helps...
<EDIT> Code updated