Search Unity

Moving Game Objects

Discussion in 'Physics' started by MichaelHotte, Feb 23, 2015.

  1. MichaelHotte

    MichaelHotte

    Joined:
    Feb 22, 2015
    Posts:
    31
    I'm very new when it comes to unity and I need some help when it comes moving game objects. I want a game object to randomly spawn in a certain area and be able to move on its own in one direction. I have the "moving on its own" part figured out, but the game object will start out slow and increasingly get faster. I want the game object to stay at the same speed the entire time from the moment it is spawned. Any help or ideas on this? The code I used for the object to move is the following:

    rigidbody.AddForce(new Vector3(0, 50, 0) * Time.deltaTime);

    Please respond with anything that may be of use
     
  2. MichaelHotte

    MichaelHotte

    Joined:
    Feb 22, 2015
    Posts:
    31
    Found the answer thanks to someone!

    void Start() {
    rigidbody.velocity = new Vector3(0f, 50f * Time.deltaTime, 0f);
    }

    There it is if anybody would happen to need it!