Entitypickmode affects childs entities?

Blitz3D Forums/Blitz3D Programming/Entitypickmode affects childs entities?

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.

you need to make the children pickabe too, use a recursive function to set the pickmode to all MESH children (see here: http://www.blitzbasic.com/codearcs/codearcs.php?code=1170 )

Now I guess you want to have one entityhandle only, to control if you eg. shot the enemy, or see the enemy etc.

Personally I solved this with a socalled orphan structure. Every main root handle of an enemy animesh will get its list of child entities (a simple nonhierarchical list). Now when linepick returns a child handle, you need to search the orphan lists to see what root parent was shot.

It may look slow, but in fact it's pretty fast because it's only comparing some ints, so checking several thousand children won't consume siginficant amounts of time.

It's up to you to use:

banks, eg:
int root entity handle
int number of orphans
int oprhan 1
int orphan 2
...

arrays:
dynamicly redim the arrays as required, using a second array to save the content before you resize the main array. Con: waste of space when the number of children differs a lot between the various meshes. Pro: easy access.

types:
create a new type instance for each enemy and a subtype instance for every child. Elegant code, but some overhead compared to banks IMHO.

Alternatively you can do it the easy way, use the Command GetParent. You need to use this recursively to find the root entity. Recursive function calls may be slower than the orphans structure I described before.