Download

Collide with screen borders

Hi,

for my game (a kind of breakout) I need some actors to collide with the borders of the visible area of the camera. Others shall not collide.
Right now, I am working with invisible walls. But that seems so unelegant to me and it offers some workflow-problems.
So I wonder, if there is a way to let my ball collide with the screen border.

Regards
Christian

Check into this node:

You can clamp the object to not go beyond a border this way. You’ll have to play around with the unit range because I don’t remember if the return value of this node is in -1 to 1 space or if it’s 0 to 1. Experiment and find out first.

Hi and thank you for the help.

That is really cool and I can use it in many other cases. For my case, I need a real physical collision.
That can be emulated, of course, but I keep on using invisible walls, which is way easier.

Regards
Christian

Oh, then in that case, use the screen borders to position collision volumes. You can place them at the half-way marks of each edge. Just make sure they are really long strips or do some begin play math that calculates how long they need to be based on the screen size.