Passing entitys directly
Blitz3D Forums/Blitz3D Programming/Passing entitys directly
| ||
Can some kind person please shed some light on this lil problem for me. I'm trying to pass a handle of an object into a function, seems to work as long as the object isnt a CHILD of an object. Here's what I'm doing: loading 'body' as parent object loading 'head' as child of body object passing the handle of the object into a function disp(body) disp(head) .. function disp(temp_handle#) .. positionentity temp_handle#,1,1,1 .. end function Works fine for body, but I get an error of 'entity does not exist' for the head. I think as its a child object, its not sending the correct pointer to the routine ?. |
| ||
Are both handles made global? |
| ||
yes.. they are now. [ whoops ] didnt make any difference though.. Like I said, if I take out the call to the function for 'head' - the body works fine. Is it something to do with the way blitz stores child objects ? - are they somehow attached to the main handle as an offset ?? (so it's not passing the correct pointer) |
| ||
Don't use floats for handles. |
| ||
got around the problem by making the second object a normal object. (parent) So I guess the error is something to do with it being a child - anyway thanks for the suggestions. |
| ||
try putting a global flag on the positionentity |
| ||
And, like Fredborg said, don't use a float. No reason to use a float when all entity handles are integers. |
| ||
No reason to use a float when all entity handles are integers. Especially because they are bound to cause Memory Access Violations, as they don't have the same numeric span and/or precision as integers. |