help with "erratic" collision error...

Blitz3D Forums/Blitz3D Programming/help with "erratic" collision error...

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.

hey peeps...

now, out of debug mode, this all works, and the game runs... BUT, put it in debug mode and i instantly get an error.

Theres too much extra code to post it all, but heres the failing chunk:

	For ent.ODE_Object = Each ODE_Object
			em=ent\mesh
			If ent\colmesh<>0 Then ent\mesh=ent\colmesh
			cm=ent\mesh
		
			;check whether this object is a sphere
			If (ent\obtype = 2 Or ent\obtype=1) And (ent\collisioncheck=1)

				;it IS a sphere so handle the mesh collision
				If EntityCollided(cm,COLTYPE_poly)  ;And CountCollisions(ent\mesh)>0    <<interesting bit
					;how many collisions for this object?
					cc=CountCollisions(ent\mesh)
					
					If cc>2 Then cc=2
					For c=1 To cc

						;update the global collision array data which will get passed to the DLL
						If Globalcolcount<colsalowed Then	GLOBALCOLCOUNT = GLOBALCOLCOUNT + 1
						c2 = GLOBALCOLCOUNT
						yc#=0:If ent\mesh=ent\colmesh Then yc=-1
						
						cx#=CollisionX(ent\mesh,c)     ;MARKED LINE!!!
						cy#=CollisionY(ent\mesh,c)
						cz#=CollisionZ(ent\mesh,c)
.......



Okay, so what im getting is at the marked line, an error saying "collision index out of bounds"..... i can't for the life of me figure it out? I am in no way altering the value of C... it appears to be coming right from the for loop. Is it possible for something to alter the value of C?

what can cause this? any advice towards fixing is greatly apreciated!

Lemme know what else you need.. (more code?)