Home > Software engineering >  Move unity gameobject around randomly like an asteroid
Move unity gameobject around randomly like an asteroid

Time:07-07

I want to move an object around a 2d screen randomly and when it leaves the windows it enters from the other side accordingly. Kinda like asteroids.

Haven't been able to find a script except this but it does not work.

https://github.com/jddunn/random-movement-AI-unity

CodePudding user response:

if i get it right if object go to right and exits screen then it will spawn at left?

CodePudding user response:

When it exit screen's screen multipy x and y variables with -1. It makes the object spawn at the another corner accordingly.

  • Related