JV-ODE Physics Thread 6

Blitz3D Forums/Blitz3D Userlibs/JV-ODE Physics Thread 6

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.

This code appeared to work prefect for me.
All that was required was a few small additions to Vip3r code.

I'll post a link to the animmesh right after I try loading just one layer.

Function CreateAnimTriMesh(trispace,mesh)

tricount=0
vertcount=0
For child=1 To CountChildren(mesh)
	For count=1 To CountSurfaces(GetChild(mesh,child))
		tricount=tricount+CountTriangles(GetSurface(GetChild(mesh,child),count))
		vertcount=vertcount+CountVertices(GetSurface(GetChild(mesh,child),count))
	Next
Next

tribank=CreateBank(tricount*3*4)
vertbank=CreateBank(vertcount*4*4)

offset=0
trioffset=0
vertoffset=0

For child=1 To CountChildren(mesh)
	For count=1 To CountSurfaces(GetChild(mesh,child))
		surface=GetSurface(GetChild(mesh,child),count)
		For vert=0 To CountVertices(surface)-1
			PokeFloat(vertbank,offset,VertexX(surface,vert))
			offset=offset+4
			PokeFloat(vertbank,offset,VertexY(surface,vert))
			offset=offset+4
			PokeFloat(vertbank,offset,VertexZ(surface,vert))
			offset=offset+8
		Next
		For tri=0 To CountTriangles(surface)-1
			For corner=0 To 2
				PokeInt(tribank,trioffset,TriangleVertex(surface,tri,corner)+vertoffset)
				trioffset=trioffset+4
			Next
		Next
		vertoffset=vertoffset+CountVertices(surface)
	Next
Next

trimeshdata=dGeomTriMeshDataCreate()

dGeomTriMeshDataBuildSimple(trimeshdata,vertbank,vertcount,tribank,tricount*3)

Return dCreateTriMesh(trispace,trimeshdata)

End Function