SHOW:
|
|
- or go back to the newest paste.
1 | using UnityEngine; | |
2 | using System.Collections; | |
3 | ||
4 | - | public class Ship : MonoBehaviour { |
4 | + | public class SnowMobileController : MonoBehaviour { |
5 | public float force = 20; | |
6 | ||
7 | // Use this for initialization | |
8 | void Start () { | |
9 | ||
10 | } | |
11 | ||
12 | // Update is called once per frame | |
13 | void Update () { | |
14 | // You may have to change rigidbody.AddForce(Vector3.back*force) to the opposite so vector3.back will end up vector3.forward | |
15 | if(Input.GetKeyDown("s")){ | |
16 | rigidbody.AddForce(Vector3.back*force); | |
17 | if(Input.GetKeyDown("w")){ | |
18 | rigidbody.AddForce(Vector3.forward*force); | |
19 | } | |
20 | if(Input.GetKeyDown("a")){ | |
21 | rigidbody.AddForce(Vector3.right*force); | |
22 | } | |
23 | if(Input.GetKeyDown("d")){ | |
24 | rigidbody.AddForce(Vector3.left*force); | |
25 | } | |
26 | }}} |