entity height?
Blitz3D Forums/Blitz3D Programming/entity height?
| ||
Hi! I've got an animated 3ds model from DarkMatter that is loaded by TerraEd which does LoadAnimMesh. Then, it does CopyEntity and ScaleEntity to place each of a couple dozen such models (monsters) on the terrain. I would like to know the height, in Blitz units, of each of these beasts, but I can't find a way to calculate that. I tried using a method based on CountSurfaces() but when I call either CountSurfaces(Entity) or CountSurfaces(Mesh) I get back zero. This seems funky. I also tried MeshHeight(Mesh) to which I could apply the scale factor for each beast, if it worked. However, the return value is -20000000 (negative twenty million). What is going so wrong with CountSurfaces() and MeshHeight()? Can anyone provide a reliable method to calculate the height of an entity copied from a 3ds mesh loaded by LoadAnimMesh? These entities animate and work just fine, but I want to know their sizes so that I can set a reasonable bounding box for each one. Thanks for any help you can provide. This is weird! |
| ||
Are you sure you are applying the command to the correct child entity within the animmesh? I think the base part is not that actual mesh itself - you need to use GetChild to find the mesh - then try the MeshHeight command on that child object. So, try this - mesh = LOADANIMMESH("file.b3d") debuglog countchildren(mesh) child1 = getchild(mesh,1) debuglog countsurfaces(child1) See if that (or some variation on that) returns any sensible values. Also you could try loading the mesh as a normal mesh and not an animmesh and see it the commands work then (also try this with your problem about linepick) - then you will narrow it down to the animated mesh causing the problem (and I still suspect you are not finding the correct child object) and you can work from there. |
| ||
I don't think using LoadAnimMesh agrees too well with mesh commands. Just my experience, but I'd suggest loading it as a normal mesh if possible. |
| ||
Sure enough... MeshWidth() etc. give ridiculous results following LoadAnimMesh but seem to give the right answers following LoadMesh. Beware! |
| ||
did you try finding the child object as I suggested? |
| ||
Vorderman: I tried your suggestion. I listed the MeshWidth, Height and Depth of the first child of the LoadAnimMesh as well as the MeshWidth etc. of the LoadMesh. I got answers approximately as follows: MeshWidth of first child: 4.05 MeshHeight of first child: 3.79 MeshDepth of first child: 4.10 MeshWidth of LoadMesh: 2.1 MeshHeight of LoadMesh: 3.65 MeshDepth of LoadMesh: 2.2 As you see, I now get *possible* values instead of the previous silly results (negative twenty million). However, the two sets of values do not agree, raising a new question - which set, if either, is correct? Yikes! |
| ||
The values returned from LoadMesh are correct, or nearly so. The values returned from checking the first child of LoadAnimMesh are not correct. |
| ||
Very odd indeed :( |
| ||
You know these sort of problems could be eliminated with a more thorough explanation in the Blitz manual regarding blitz3d required protocol for importing meshes and such. I had a hard time findng the children of my level mesh - they simply were not there....until I loaded it in as an animmesh!! Which is bollocks that should be explained properly from somebody who knows about Blitz's inner workings...save us all a headache with what seems like obvious and straight forward stuff. |
| ||
Have you done a renderworld? http://www.blitzbasic.com/Community/posts.php?topic=26385#274511 Blitz seems to report non zero sizes on surfaces with no size. I reported this almost 1 year ago and the bug report was ignored. |