finding nearest objects next to cameraview

i want to manipulate the nearest object the user can see: how can i find which object is the nearest to the main-charakter/cameraview?

Two approaches come to mind:
(1) iterate through all of your objects, and compute the distance from each one, then take the smallest.

(2) use the collision system, for instance similar to the numerous “picking” examples, and use the CollisionHandlerQueue.sort() method to report the closest.


ok thx. but how do i know if it’s inside the camera/user-view-angle?

Try searching the forums for isInView.