Search Unity

Rool a ball tutorial (Help)

Discussion in 'Getting Started' started by Luke3671, Aug 20, 2016.

  1. Luke3671

    Luke3671

    Joined:
    Jul 6, 2014
    Posts:
    56
    Hello,
    I'm new to whole unity, I just learning things (Coding ect...) I just finished
    https://unity3d.com/learn/tutorials/projects/roll-ball-tutorial

    but problem i am having right now is that when using the arrows keys... Mine is doing

    "Up is down"
    Down is up
    Left is right
    Right is Left

    The code is below, I checked if i did anything wrong from the tutorial but as i can see i have not i even copy/paste the code they give with every video.

    Thank you if you can help me & sorry if in wrong part of unity forum.

    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.UI;
    3. using System.Collections;
    4.  
    5. public class PlayerController : MonoBehaviour {
    6.  
    7.     public float speed;
    8.     public Text countText;
    9.     public Text winText;
    10.  
    11.     private Rigidbody rb;
    12.     private int count;
    13.  
    14.     void Start ()
    15.     {
    16.         rb = GetComponent<Rigidbody>();
    17.         count = 0;
    18.         SetCountText ();
    19.         winText.text = "";
    20.     }
    21.  
    22.     void FixedUpdate ()
    23.     {
    24.         float moveHorizontal = Input.GetAxis ("Horizontal");
    25.         float moveVertical = Input.GetAxis ("Vertical");
    26.  
    27.         Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
    28.  
    29.         rb.AddForce (movement * speed);
    30.     }
    31.  
    32.     void OnTriggerEnter(Collider other)
    33.     {
    34.         if (other.gameObject.CompareTag ( "Pick Up"))
    35.         {
    36.             other.gameObject.SetActive (false);
    37.             count = count + 1;
    38.             SetCountText ();
    39.         }
    40.     }
    41.  
    42.     void SetCountText ()
    43.     {
    44.         countText.text = "Count: " + count.ToString ();
    45.         if (count >= 7)
    46.         {
    47.             winText.text = "YOU WIN!!!";
    48.         }
    49.     }
    50. }
     
  2. tedthebug

    tedthebug

    Joined:
    May 6, 2015
    Posts:
    2,570
    Have you checked your camera position? If it is on the opposite side of the ball then the movement would appear to be the opposite to what you are pressing.