Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

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!