identifying a 3d object in 3d space

Blitz3D Forums/Blitz3D Programming/identifying a 3d object in 3d space

gellyware(Posted 2003) [#1]
Say I create a 3d world, this world consist of a .x file, and in this world, you have 10 cylinders. Is there a way to select each of these cylinders and/or locate their position in 3d space in blitz3d?


Sunteam Software(Posted 2003) [#2]
You really should load them as seperate entities so that you can uniquely identify them as Blitz will only identify by each collection of surfaces loaded as one mesh, i.e. your loading your 10 cylinders as one object/mesh instead of 10 which would be more useful for your purpose.


jhocking(Posted 2003) [#3]
Not necessarily. If they are separate objects within the .x file (eg. child objects linked to the world) they can be uniquely identified in Blitz. You have to use LoadAnimMesh however and use FindChild or GetChild or something to access the objects.


RayTracer(Posted 2003) [#4]
how come that you can use Findchild & getchild method only with LoadAnimMesh


jhocking(Posted 2003) [#5]
Because LoadMesh combines everything into a single mesh like Sunteam described whereas LoadAnimMesh preserves heirarchy/separate objects within the model. The reason the command is called LoadAnimMesh is because the most common reason for heirarchy/separate objects within a model is for animation.


(tu) sinu(Posted 2003) [#6]
you can only use it with loadanimmesh because loadmesh doesn't load any heirachy info and just has the mesh as one piece.


gellyware(Posted 2003) [#7]
FindChild ( entity,child_name$ )

ok so the command says, "Returns the first child of the specified entity with name matching child_name$."

So if my entity was ground and the child was cylinder5

FindChild (ground, cylinder5), this returns the 5th cylinder, but what does that mean :) If I want to be able to click on each cylinder with my mouse and have it change color, is that possible? (all cylinders are in the mesh, and are loaded in with ground = LoadAnimMesh ("ground.x")


Ricky Smith(Posted 2003) [#8]

FindChild (ground, cylinder5), this returns the 5th cylinder, but what does that mean :)



It means you can do :

Cylinder5=FindChild(ground,"cylinder5")

You now have a handle to the cylinder - Cylinder5 - and you can do what you like to it the same as any other entity.If Cylinder5 is a global variable then you can access it from anywhere in your program.


gellyware(Posted 2003) [#9]
i see, thank you all!