I’ve only been using unity for two days and I have this script:
using UnityEngine;
using System.Collections;
using System;
public class NewBehaviourScript : MonoBehaviour {
public float spin;
public Rigidbody rb;
private float magnitude;
void Start () {
rb = GetComponent<Rigidbody>();
}
void FixedUpdate() {
float h = Input.GetAxis("Horizontal") * magnitude * Time.deltaTime;
Rigidbody.AddTorque(transform.forward * h);
}
}
(I didn’t make most of this! It’s from a tutorial and I edited it!)
it wont work and I keep getting this:
object reference is required for the non-static field, method, or property ‘Rigidbody.AddTorque(Vector3)’
what do I do? thx!