Search Unity

Creating Momentum

Discussion in 'Scripting' started by XZ001, Dec 29, 2011.

  1. XZ001

    XZ001

    Joined:
    May 21, 2011
    Posts:
    166
    Ok, I'm starting a game that is some what revolved around physics. In the game I want the player to be able to customize a rocket (starting with basic parts then buying new parts) then launch it with the goal of getting it as high as possible (Yes, this was partially inspired by the game "Into Space"). I've done movement before, but always simple things like pressing the arrow keys to make a character move forward. I want to make more realistic movement that will be based on the momentum of a rocket so when it turns it will continue it the direction it was going until friction slows it down and start going in the new direction. Also if the engines die it will continue until gravity negates the upward momentum and pulls it down. I'm not asking for anyone to write a script, but any reference pages you can show me would be helpful. Thanks!
     
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Use a rigidbody along with AddForce. Add drag to simulate friction.

    --Eric
     
  3. XZ001

    XZ001

    Joined:
    May 21, 2011
    Posts:
    166
    Thanks, that looks like exactly what I need. :D