Periodic boundary conditions

Hi guys
Im creating a 3d box with periodic boundary conditions. I want to have an object, for example a sphere inside the box, moving around and when it reaches the edge of the box it will get teleported to the opposite side of the box. So far, i am able to use Begin overlap, but one of the problems is that i want the sphere to teleport when its exact position (exact center of the sphere) hits the boundary and not the edge of the sphere. Any idea on how that can be done?

Also it could be awesome to have the sphere partially appearing on the other side the more it overlaps with the edge of the box. Any ideas for that?

Also, if it doesnt make sense let me know or make a quick google search for periodic boundary conditions in molecular dynamics.

Kind regards

You need to watch the sphere position, basically. And when it reached the limit, move it.

You need two spheres for this.

Well that means i have to check for the position on tick. I always avoid having something on tick. Also at some point in the actual use case of this, i might have several hundred spheres inside the box at once moving around randomly. Then it might get too heavy for the game?

It’s ok if you do it correctly.

A crafty way to make particle systems follow the player, without the player knowing, is to do this to all the particles, on tick.

So I assume several hundred spheres is ok :slight_smile:

Interesting. I will definitely give that a try. I forgot to mention that i am developing for VR, so hopefully it wont affect performance too much :slight_smile:

Also, regarding the other thing. Is there are a way to slice the sphere to make it partially appear on the other side?

Slicing it is a whole different ballgame. No idea off the top of my head…