Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Player input relative force adding

Discussion in 'Physics' started by shotoutgames, Dec 8, 2019.

  1. shotoutgames

    shotoutgames

    Joined:
    Dec 29, 2013
    Posts:
    290
    I currently have
    Code (CSharp):
    1.   rb.AddRelativeForce(airForceAddX, addedNegativeForce, airForceAddZ, ForceMode.Acceleration);
    when player in air.
    airForceAddX is input left and right and airForceAddZ is input forward and back.
    So when I push the stick forward the player goes forward relative to where he is and the same for left right.
    However I want the force to be added relative only when going forward, but I want the player to go left and right on the screen (world space?? ) when going left right.
    So basically relative force forward but regular add force left right.
    Any ideas? Seems like it should be simple but I am stumped.