Search Unity

platform

Discussion in 'Scripting' started by KhmerDude, Feb 10, 2016.

  1. KhmerDude

    KhmerDude

    Joined:
    Oct 18, 2012
    Posts:
    105
    Hi, Im making me a basic runner game and while I was testing it in my PC, the character runs smoothly but when i test it in my phone it seems to move a little faster and the control is not that responsive.
    when the user tab the screen the character jump. all the character does is jump
    Code (CSharp):
    1. public void Jump(){
    2.    
    3.        
    4.         rigidbody2D.velocity = new Vector2(rigidbody2D.velocity.x,0);
    5.         rigidbody2D.AddForce(new Vector2(0,jumpHeight));
    6.          jumpAudio.PlayOneShot(jump, .2f);
    7.        
    8.     }
    9.  

    and the platform move with this
    Code (CSharp):
    1.     void Update () {
    2.         transform.Translate(-1.9f * Time.deltaTime,0,0);
    3.     }
    does anbody have any idea how to fix this or maybe modify the jump script to fix this
     
  2. LeftyRighty

    LeftyRighty

    Joined:
    Nov 2, 2012
    Posts:
    5,148
    you've not really given enough to go on here, how are you detecting input?
    are you trying to detect input in fixedupdate? its' a common pitfall that can cause sluggish controls...
     
  3. KhmerDude

    KhmerDude

    Joined:
    Oct 18, 2012
    Posts:
    105
    im the unity UI button, when the user touch the button the jump will respond appropriately