Skip to content

Instantly share code, notes, and snippets.

@junwatu
Created May 1, 2016 23:58
Show Gist options
  • Save junwatu/15550de11dc61ba0f72ffa54df45af2c to your computer and use it in GitHub Desktop.
Save junwatu/15550de11dc61ba0f72ffa54df45af2c to your computer and use it in GitHub Desktop.
Torque - Unity 3D
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