Search Unity

Random Movement

Discussion in 'Scripting' started by Tarey, Mar 27, 2015.

  1. Tarey

    Tarey

    Joined:
    Mar 19, 2015
    Posts:
    6
    Hi, I have been researching on a random movement script for an object on a plane. However, most of them concern with attaching the script to the object instead of on the plane.

    What I want is how do you write a script onto a plane, to trigger anything that is on or lands on the plane to start random movement - essentially a random movement area that causes objects to move randomly, instead of random movement objects each individually move randomly according to their own script?
     
  2. Timelog

    Timelog

    Joined:
    Nov 22, 2014
    Posts:
    528
    You could use on OnCollisionStay to send some random direction/velocity to each colliding object.
     
  3. Tarey

    Tarey

    Joined:
    Mar 19, 2015
    Posts:
    6
    Thanks! Gonna try that out, will report back.