b3d Pipeline and Helpers

Blitz3D Forums/Blitz3D Programming/b3d Pipeline and Helpers

KuRiX(Posted 2005) [#1]
Helloooo....

I am using 3dsmax with b3d pipeline. I want to export some helpers for control points and other information together with the map. Once exported, i have to use loadanimmesh or the helpers don't appear. But i need to use loadmesh to have proper collision with ode.dll.

So, what i am doing is to load with loadanimmesh, get the helpers, free the map, and reload with loadmesh.

Obviuosly this is a very slow way. Is there anyway to export the b3d with the helpers so i can loadmesh and get them?

Thanks in advance!


KuRiX(Posted 2005) [#2]
nobody? :(


Caff(Posted 2005) [#3]
LoadAnimMesh loads a mesh hierarchically - when you load a mesh this way and try to apply collision, you need to apply the collsion type to each child in the model / scene.

To do this, load the map with loadanimmesh, then parse all the child objects, like this:

map = LoadAnimMesh("map.b3d")

ent = citymap
While ent
    EntityType(ent, COLL_TYPE_MAP)
    ent = NextChild(ent)
Wend

You need this function from the code archives too - credit to Beaker.
Function NextChild(ent)
	If CountChildren(ent)>0
		Return GetChild(ent,1)
	EndIf

	Local foundunused=False
	Local foundent = 0, parent,sibling
	While foundunused=False And ent<>0
		parent = GetParent(ent)
		If parent<>0
			If CountChildren(parent)>1
				If GetChild(parent,CountChildren(parent))<>ent
					For siblingcnt = 1 To CountChildren(parent)
						sibling = GetChild(parent,siblingcnt)
						If sibling=ent
							foundunused = True
							foundent = GetChild(parent,siblingcnt+1)
						EndIf
					Next
				EndIf
			EndIf
		EndIf
		ent = parent
	Wend
	Return foundent
End Function


If you have placed the 'helpers' (waypoints?) in the map, you could use a naming convention like "waypoint_1", and then in the While loop above, use EntityName$(ent) to determine if the object is a placeholder (in which case you can hide it / not apply collisions to it).


KuRiX(Posted 2005) [#4]
Thanks for the reply. The problem is that i am using the trimesh collision from ODE. So i need to pass ode all vertex and triangle data from the mesh. The only way i have it working is using loadmesh and then passing the data.

If i use loadanimmesh i can't pass the data correctly.

So instead of this, i would like to know why using loadmesh i can't find the helpers (waypoints, yes)... or how to tell blitz not to collapse the helpers into the mesh.

Thanks anyway!


Caff(Posted 2005) [#5]
It's because LoadMesh does not contain hierarchical entity information.

I'm not familiar with ODE - can you call the trimesh function on each ent found when iterating through the mesh as above?


KuRiX(Posted 2005) [#6]
I have tried that, but with no success. Of course it will be my fault...

Keep Trying!


Caff(Posted 2005) [#7]
I will test some stuff out later, I have JV-ODE at home


AdrianT(Posted 2005) [#8]
Not sure how Cygnus is doing it in code, but were using ODE but with invisible proxy collision meshes for all gameplay interaction. All of the pipeline stuff is mostly visual and doesn't get interacted with dirctly.

Seems to work pretty well as we have 8 vehicles over broadband and LAN with ODE physics and some pretty sophisticated AI running well. must be about 40,000 polys total all included.