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

Clunky Movement script

Discussion in 'Editor & General Support' started by dm308362, May 7, 2019.

  1. dm308362

    dm308362

    Joined:
    Oct 26, 2018
    Posts:
    1
    I am currently attempting to solve my current problem with my game involving movement using the rigidbody component of the player. I am using my previous script that allows the user to move around using separate key inputs that previously used Transform.Translate. The keys all change direction with self explanation, here's the code of the rigidbody movement:

    CurrentPlayer.GetComponent<Rigidbody>().MovePosition(CurrentPlayer.transform.position - (CurrentPlayer.transform.right * MathSpeed));

    The problem is when that two of these are called at once, only one is played. preventing strafing during the holding of w & d, and prevents w & s canceling out movement.
    I really just need to find something that actually moves the object properly, changing the inputs wouldn't be that bad.
    This is currently just a bad Transform.Translate.
     
    Last edited: May 7, 2019