Jedive ODE Wrapper

Blitz3D Forums/Blitz3D Userlibs/Jedive ODE Wrapper

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.

Your problems in blitz are nothing to do with ODE - they don't affect one another...

I don't know why you're mentioning the Blitz3D problem? there is no visible trimesh. There is only a Blitz3D mesh - with all associated Blitz3D problems... I take it you're prolly not that used to Blitz3D yet?

ODE keeps it's own mesh data entirely seperarate. I think you are working with a bad mesh.

Here is some extra trimesh code, taken from arkon's, and modified by me to use world space verts:
;creates the ent to collide with - see ODESPACE variable and pass your space to it along with your mesh.
Function ODECollision(mesh,ODESpace)
	tris_count% = 0
	vert_count% = 0
	For i = 1 To CountSurfaces(mesh)
		tris_count = tris_count + CountTriangles(GetSurface(mesh, i))
		vert_count = vert_count + CountVertices(GetSurface(mesh, i))
	Next
	vertices_bank% = CreateBank(vert_count * 4 * 4)
	indices_bank% = CreateBank(tris_count * 3 * 4)
	offset% = 0
	offset_tris% = 0
	baseverts=0
	For i = 1 To CountSurfaces(mesh)
		sf = GetSurface(mesh, i)
		For v = 0 To CountVertices(sf) - 1
			TFormPoint VertexX(sf, v),VertexY(sf, v),VertexZ(sf, v),mesh,0
			PokeFloat vertices_bank, offset, TFormedX()
			offset = offset + 4
			PokeFloat vertices_bank, offset, TFormedY()
			offset = offset + 4
			PokeFloat vertices_bank, offset, TFormedZ()
			offset = offset + 8
		Next
		For t = 0 To CountTriangles(sf) - 1
			For j = 0 To 2
				v = TriangleVertex(sf, t, j)+baseverts
				PokeInt indices_bank, offset_tris, v
				offset_tris = offset_tris + 4
			Next
		Next
		baseverts=baseverts+CountVertices(sf)
	Next
	
	t_data = dGeomTriMeshDataCreate()
	dGeomTriMeshDataBuildSimple(t_data, vertices_bank, vert_count, indices_bank, tris_count * 3)
	Return dCreateTriMesh(ODESpace, t_data)
End Function


When you're done with ODE, it should just work with this routine fine with no changes in Blitz... Verts are in world space so the orientation of the entity doesn't matter.

PLEASE DONT take this routine as gospel though as obviously the Jedive ODE wrapper might be different?