Multi types and functions

Blitz3D Forums/Blitz3D Programming/Multi types and functions

Couple of things. First, you have:
Dim objects.ODE_object(200)
For n=0 To 200
	objects(n) = New ODE_object
Next

Which fills the array with blank ODE_object instances, but you then have:
	set_material(objects(n),mat_ice)
	objects(n)=create_Box(Rnd(-40,40),100+Rnd(0,600),Rnd(-40,40), x,y,z, Rnd(-30,30),Rnd(-30,30),Rnd(-30,30))	

	i = objects(n)\mat\index

Which is presumably inside a loop as you're using 'n' as an index. This fills the array again with ODE_objects, created and returned from the call to create_Box().

Also, in that code, you need to call set_material() after the call to create_Box().