types help

Blitz3D Forums/Blitz3D Programming/types help

heres my problem, i've got a type

TYPE PushableItem
FIELD model, name$
FIELD weight, CollType, BeingPushed
END TYPE

now what im trying to do is check if one mesh of the type is intersecting with another mesh of the same type.

I've tried a few functions but all end up the same, some boxes go through each other and some dont, seems a bit hit and miss.
heres function i tried among others, this one is giving the best results yet once every so often if misses..

;############################################

Function MovingPushableItemToPushableItemCollision()



For p.PushableItem = Each PushableItem


If p\BeingPushed = 1

MeshA = p\model

EndIf



For a.PushableItem = Each PushableItem

If a\BeingPushed = 0

MeshB = a\model

EndIf



If MeshA <>0 And MeshB<>0
If MeshesIntersect(MeshA,MeshB)

TranslateEntity MeshA,(char\move)*(collsnx),0,(char\move)*(collsnz)
TranslateEntity char\PlayerPivot,(char\move)*(collsnx),0,(char\move)*(collsnz)

EndIf
EndIf



Next


Next



End Function