Hi,
2) if I want to pick up a bigger sphere (planet, for example a sun) with my grid catcher how to do that for different size of planets?
You already have radius member in planetary objects user data. So to check if mouse points to given object, just check, whether the position is inside the object radius (with some safety offset). I would recommend to store all planet IDs in array, and then you can do something like:
FOR i = 1 to planetCount
TBGL_EntityGetPos(%sScene, planet(i), x, y, z)
data = TBGL_EntityGetUserDataPointer(%sScene, planet(i))
IF TBGL_PointInside3D(MouseX, MouseY, MouseZ, %TBGL_OBJ_SPHERE, x, y, z, data.radius) THEN
' -- This is our object, let's mark it and so on
...
EXIT FOR ' -- Stop searching
END IF
NEXT
Side note: Have a look at article "EntityDataSignature", it discusses approach on how to sign different objects in scene using unique value. This way, if you create planets even in random order, but with planetary signature, you can retrieve their complete list to array anytime later.
Other approach could be modification of your current one. You would store the biggest radius in scene and then use:
entity = TBGL_EntityFindNearestByPos(%sScene, %TBGL_DISPLAYLIST , MouseX, MouseY, MouseZ, biggestRadius, biggestRadius, biggestRadius)
But I guess this is not the best approach if you wish to include other objects than spheres in display lists later (could give false positives).
Petr
P.S. Ciao Simone, its great to see you more active on the forum lately!
Bookmarks