What I really need is the x,y of the object when it is outside of the screen:
I'm actually coding a UI in Objective-C, not a game.
In this different kind of UI you navigate a 3D space with objects.
An observer is at (x=0,y=0,z=0) and objects have realCenter and realSize.
realSize is the size of the objects at z=1.
I have calculated the angular center of the objects to be:
angularCenterX = (objectRealCenter.x - observerCenterX) / distanceFromObserver
Objective-C code:
CGPoint angularCenter = CGPointMake((object.realCenter.x - observer.center.x) / distance,
(object.realCenter.y - observer.center.y) / distance);
It works but when the observer passes the objects, the objects warp around. Instead of disappearing like they normally should, they come back.
The slider controls the z of the observer, as it moves and passes an object the objects comes back:
I'm sorry the gif is too slow.