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. Dismiss Notice

Basic Physics C# script

Discussion in 'Editor & General Support' started by 3d_woah, Feb 2, 2015.

  1. 3d_woah

    3d_woah

    Joined:
    Feb 2, 2015
    Posts:
    2
    Hello,

    I am in the very beginning stage of learning how to create game objects and apply physics to make them move. I watched the tutorial for simple ball game, and followed the instructions exactly, but still can't seem to make the ball move with my keyboard presses.

    this is the C# script entered...
    Code (CSharp):
    1.  
    2.  
    3. usingUnityEngine;
    4. usingSystem.Collections;
    5.  
    6. publicclassPlayerController : MonoBehaviour
    7. {
    8.  
    9. voidFixedUpdate()
    10. {
    11. floatmoveHorizontal = Input.GetAxis("Horizontal");
    12. floatmoveVertical = Input.GetAxis("Veritcal");
    13.  
    14. Vector3movement = newVector3(moveHorizontal,0.0f,moveVertical);
    15.  
    16. rigidbody.AddForce(movement);
    17. }
    18.  
    19. }
    another question.. when setting up my game, do i need to clarify what output it will be (Web, .exe, flash) before or is after ok?

    thank you for your help!
     
    Last edited: Feb 2, 2015
  2. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
  3. 3d_woah

    3d_woah

    Joined:
    Feb 2, 2015
    Posts:
    2