the simplest i think is to add some equate for the already existing TBGL-functions so these are fully functional on all entity-types TBGL provides us with currently...
A function-slot does not mandatory need to have a user-type attached - does it? It sounds reasonable at first if it would work like:
"please TBGL, list all enemy-spaceships near that point xy" but i think then i would just go myself through the list of enemy-spaceships but not through all entities then and measure all theirs distances...
edit: it's thinkeable - if it were faster than in a tB-script- if TBGL would examine a scene and just go through a passed list of entities - and return what is left then.
So user sends a string, array or now possible too: variadic parameter-list of entity-IDs that might be interesting, TBGL could probably be faster than the user to check for distances in a range to a certain point or entity and TBGL returns the closest entityID of the listed ones in range - or zero if none in range.
If getting closest listed entity by position it's pretty simple - but if the referred entity is also in the list... hmmm- return any other but itself nor any of its own children...
Function TBGL_EntityGetClosest( ByVal sceneID As Long, _
ByVal entityID As Long, _
ByVal listIDs(Any) As Long, _
Optional Byval maxRange As Double _
) As Long
'...
Function TBGL_EntityGetClosestPos( ByVal sceneID As Long, _
ByVal X As Double, _
ByVal Y As Double, _
ByVal Z As Double, _
ByVal listIDs(Any) As Long, _
Optional Byval maxRange As Double _
) As Long
'...
edit+
if we already on it, i have two and a half simple suggests that might be handy one day:
' - 1 -
Function TBGL_EntityIsChildOf( ByVal SceneID As Long, -
ByVal suspectedChildID As Long, _
ByVal suspectedParentID As Long _
) As Boolean
While TBGL_EntityExists(sceneID, suspectedChildID )
suspectedChildID = TBGL_EntityGetParent( SceneID, suspectedChildID )
If suspectedChildID = suspectedParentID Then Return TRUE
Wend
End Function
' - 1.5 - almost the same as above:
Function TBGL_EntityGetTopParent(ByVal SceneID As Long, _
ByVal EntityID As Long _
) As Long
While TBGL_EntityExists( SceneID, TBGL_EntityGetParent( SceneID, EntityID ))
EntityID = TBGL_EntityGetParent( SceneID, EntityID )
Wend
Function = EntityID
End Function
' - 2 -
Function TBGL_EntityExists( ByVal SceneID As Long, ByVal EntityID As Long) As Boolean
Function = ( TBGL_EntityGetFreeID( SceneID , EntityID ) <> EntityID )
End Function
Bookmarks