Screen Edge


Is there a way in code to detect if an object has gone beyond the screen edge. Is there a code ref for “screen edge”?.

I’m thinking in the lines of

if(myObject.position([]) >= myObject.position([0,screenEdge0]))

Basically, if it’s equal or goes beyond then it stays where it is.


Hello @frank.glennon,

I don’t think so but, here, take a look in this topic, maybe it’ll help you:

Also, I have to say that u may use a trigger around the screen (in outside part) to delimitate the screen area and the you use the trigger’s events to do what you want. Here’s the article about it:

Hope it helps ya!

att, Higão.


Hi @frank.glennon,

Z.screenLeft and Z.screenRight refer to the left and right edges of the screen, respectively (you can find a description of their coordinates here).

You can keep track of an object’s position value in a script, and check whether its value is higher/lower than the limits of the screen, and if so, reset its transform values e.g. if the left edge is 0 in the y axis, and an object’s y position is lower than this, then we reset its y position to 0.

Our UI coordinate systems article may also come in handy.

Hope this helps.

All the best,