Question by
Headkill1 · Sep 25, 2015 at 09:44 PM ·
error message
HELP IM NEW AND THIS KEEPS POPPING UP
SO im trying to test this
var Rotationspeed = 100;
function Update () {
var rotation : float = Input.GetAxis ("Horizontal") * Rotationspeed;
rotation *= Time.deltaTime;
UnityEngine.Rigidbody();
Rigidbody.AddRelativeTorque (Vector3.back * rotation);
BUT I GOT LIKE ONLY 1 FREAKIN ERROR AND ITS FUSTRATING ME.
it says an instance of type 'UnityEngine.Rigidbody' is required to acess non static memeber 'addrelevativetorque'
HELP
Comment
Answer by Headkill1 · Sep 25, 2015 at 09:57 PM
ive literally got rid of every other error but that one
Answer by yoda12 · Sep 26, 2015 at 01:45 AM
@Headkill1 Try this
var rb: Rigidbody;
function Start() {
rb = GetComponent.<Rigidbody>();
}
var Rotationspeed = 100;
function Update () {
var rotation : float = Input.GetAxis ("Horizontal") * Rotationspeed;
rotation *= Time.deltaTime;
rb.AddRelativeTorque (Vector3.back * rotation);
}
From http://docs.unity3d.com/ScriptReference/Rigidbody.AddRelativeTorque.html
Your answer
Follow this Question
Related Questions
Keep getting Null reference error for AI Script 1 Answer
Unity 2017 playmode is not working 0 Answers
IndexOutOfRangeException in TextureInspector 1 Answer
grandle build fail 0 Answers