Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class SnowMobileController : MonoBehaviour {
- public float force = 20;
- // Use this for initialization
- void Start () {
- }
- // Update is called once per frame
- void Update () {
- // You may have to change rigidbody.AddForce(Vector3.back*force) to the opposite so vector3.back will end up vector3.forward
- if(Input.GetKeyDown("s")){
- rigidbody.AddForce(Vector3.back*force);
- if(Input.GetKeyDown("w")){
- rigidbody.AddForce(Vector3.forward*force);
- }
- if(Input.GetKeyDown("a")){
- rigidbody.AddForce(Vector3.right*force);
- }
- if(Input.GetKeyDown("d")){
- rigidbody.AddForce(Vector3.left*force);
- }
- }}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement