- Home /
How do you add rigid body to this object....
I was following some udemy online class and some local online tutorial and microsoft guide here and I have imported a gameobject in my game which I created in a 3d modeling software. Now I would like control the movement of that gameobject so that as soon as it hits another gameobject it should stop his movement.
I have read that for this a gameobject needs a rigidbody. So how and where in the script can I add a rigidbody to that gameobject?
Comment
Answer by rohandoesunity · Jun 18, 2020 at 02:02 AM
Rigidbody rb = gameObject.AddComponent();
that should do the trick if you need to add the rigidbody in a script,
however, you can just click add component in the inspector and add it