- Home /
An instance of type 'UnityEngine.Rigidbody' is required to access non static member 'AddRelativeTorque'. - I don't understand the problem
[1]Hello, I need help with this script because i don't understand the problem
#pragma strict
var rotationSpeed = 100;
function Update ()
{
var rotation : float = Input.GetAxis ("Horizontal") * rotationSpeed;
rotation *= Time.deltaTime;
UnityEngine.Rigidbody.AddRelativeTorque (Vector3.back * rotation);
}
Answer by FLASHDENMARK · Sep 02, 2013 at 01:07 PM
rigidbody.AddRelativeTorque (Vector3.back * rotation);
It is rigidbody with a small 'r'
I tried it but this happened: "Assets/BallControl.js(9,21): BCE0019: 'rigidbody' is not a member of 'UnityEngine'. Did you mean 'RigidbodyConstraints'?"
I tried with
UnityEngine.RigidbodyConstraints.AddRelativeTorque (Vector3.back * rotation);
}
but: "BCE0019: 'AddRelativeTorque' is not a member of 'UnityEngine.RigidbodyConstraints'."
I tried and:
RigidbodyConstraints.AddRelativeTorque (Vector3.back * rotation); }
but nothing...
Answer by akashd50 · Jun 17, 2017 at 04:32 PM
I think should be... GetComponent.().AddRelativeTorque(Vector3.back * rotation);
Your answer
Follow this Question
Related Questions
An instance of type UnityEngine.X is required to access non static member 'Y'. 2 Answers
How to send a private message to another Unity Answers user? 1 Answer
basic 2D camera setup 2 Answers
Is it possible to make a GUI without using the In-Built Version 1 Answer
Spawn game objects on a timer 2 Answers