topical media & game development

talk show tell print

lib-unity-demo-character-unity-Assets-VirtualWorldExample-WalkAround.js / js



  function Start()
  {
      // Rotate the character to a random direction.
      transform.Rotate(0, Random.Range(0, 360), 0);
  }
  
  function FixedUpdate()
  {
      // Move the character a bit each frame.
      transform.position += transform.forward * .02;
      
      // Destroy the character when it's out of view.
      if (Vector3.Distance(Vector3.zero,transform.position) > 20)
                  Destroy(gameObject);
  }


(C) Æliens 04/09/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.