Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Voting for the Unity Awards are OPEN! We’re looking to celebrate creators across games, industry, film, and many more categories. Cast your vote now for all categories
    Dismiss Notice
  3. Dismiss Notice

how to calculate next position of an object

Discussion in 'Scripting' started by mirkojpn, Oct 14, 2018.

  1. mirkojpn

    mirkojpn

    Joined:
    Mar 31, 2018
    Posts:
    126
    hello!
    thank's you for your help in advance.

    actually i'm trying to figure out how to know my player position after a 3 seconds, it moves 5 m/s and he it's moving by applying velocity to the transform.foward.

    there is a usefull unity math function to calculate it?
     
  2. fire7side

    fire7side

    Joined:
    Oct 15, 2012
    Posts:
    1,819
    I'm not sure, but I think you would multiply the transform.eulerAngles * speed * time and add it to the original position.
     
  3. SparrowGS

    SparrowGS

    Joined:
    Apr 6, 2017
    Posts:
    2,536
    Right, execpt you need to use transform.position + (transform.forward * speed * time)

    I dont see how the euler angles get you there
     
    mirkojpn likes this.
  4. fire7side

    fire7side

    Joined:
    Oct 15, 2012
    Posts:
    1,819
    Yeah, I wasn't thinking quite clear on that, thanks.
     
  5. mirkojpn

    mirkojpn

    Joined:
    Mar 31, 2018
    Posts:
    126
    thank's you,!