Created
May 1, 2016 23:58
-
-
Save junwatu/15550de11dc61ba0f72ffa54df45af2c to your computer and use it in GitHub Desktop.
Torque - Unity 3D
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
public class Torsi : MonoBehaviour { | |
public Rigidbody rb; | |
public float torque; | |
void Start () { | |
rb = GetComponent<Rigidbody>(); | |
} | |
void FixedUpdate () { | |
float turn = Input.GetAxis("Horizontal"); | |
rb.AddTorque(transform.up * torque * turn); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment