- Home /
How do I apply drag rigidbody?
I want to click on an object and move it with my mouse. I have a prefab object with a rigidbody & springjoint. I applied dragrigid body script to the prefab in the project view, i get following error:
NullReferenceException: Object reference not set to an instance of an object DragRigidbody.Update () (at Assets\Standard Assets\Scripts\DragRigidbody.js:20)
first apply the rigidbody from component physics then apply the script to the camera
Answer by Thom Denick · Jul 19, 2010 at 09:48 PM
The DragRigidBody script doesn't go on the RigidBody you want to drag, it goes on a controller script such as First Person Controller. An in-depth explanation can be found here:
http://answers.unity3d.com/questions/4898/drag-gameobject-with-mouse
Answer by usman_the_great · Jul 19, 2010 at 11:07 PM
apply the rigidbody to the object you want to drag than select your camera and apply the drag rigidbody to the camera use mouse to drag
Your answer
Follow this Question
Related Questions
object not set to instance..........again. 2 Answers
Passing the object as event argument 1 Answer
Instantiate a COMPLETELY Unique Instance of an Object 1 Answer
NullReferenceException: Object reference not set to an instance of an object ..... 1 Answer
How drag a block along Z-Axis and keep it under the mouse? 1 Answer