Disable Rigidbody

I got an object with rigidbody on it. This object can be lanch to the air and after 3 second do What is needs to do and disappier.

The problem is that the object keeps moving when it shouldn’t. I don’t talk about disable the gravity, I talk about disable movment on any axis or remove rigidbody completly.

I’m using java script.
Sorry for poor english.

You could also do like this if you want to disable the rigibody.

                rigidbody.isKinematic = true;
                rigidbody.detectCollisions = false;

Making rigidbody.isKinematic = true;rigidbody.usegravity=false will make it non effected by rigidbody physics and vice versa will make it rigidbody
Or other workaround (little bit expensive ,but should work)is

void Update () {
	if(Input.GetKeyDown(KeyCode.A))
			AddRigidbody();
			if(Input.GetKeyDown(KeyCode.B))
			RemoveRigidbody();
	
	
	}
	void AddRigidbody()
	{
		if(!this.gameObject.GetComponent<Rigidbody>())
		this.gameObject.AddComponent<Rigidbody>();;

	}
	void RemoveRigidbody()
	{
		if(this.gameObject.GetComponent<Rigidbody>())
		Destroy(this.gameObject.GetComponent<Rigidbody>());
	}

If you don’t need the object anymore, you could just destroy it. But if you do, save the objects transform.position and transform.rotation to a variable just before you make it disappear and reposition it every frame that it is hidden.

Update()
{
if(hidden)
{
transform.position = storedPosition;
transform.rotation = storedRotation;
}
}

Hope this helps.

You can make the rigidbody kinematic or set its velocity to (0, 0, 0) when you need to.

rigidbody.isKinematic = true;
rigidbody.velocity = Vector3.zero;