Velocity on a rigidbody won't stop?

So this is probably going to be a really simple fix to a really stupid problem but I’ve been trying to figure this out for hours to no avail.

I have a basic script for a mobile VR project in which the ‘character’ (in this case the main cam with a CC and Rigidbody attached) starts off stationary, then when Fire1/Mouse0 is clicked, it starts to fly in whatever direction the user is facing using velocity.

The issue is, when the user clicks the button again, the camera should stop completely in place, until clicked again and the camera starts moving, etc etc.

However, when the button is clicked to stop the camera moving, it just continues on it’s path, regardless of where the user looks.

I’ve been experimenting for a good while and it definitely seems to be the velocity line;

cc.velocity = transform.forward * forwardSpeed;

that doesn’t seem to want to stop when the button is triggered a second time. But I’m fairly new to all this so it may just be an oversight.

I’ll attach the code I’ve used, if anyone needs more details I’m happy to provide. Thanks in advance.

public Transform vrCamera;
private Rigidbody cc;

public float forwardSpeed = 50f;

Vector3 axis;
float rotationY;
float rotationX;
float rotationZ;

bool start = false;

void Start () {
	cc = GetComponent<Rigidbody> ();

	vrCamera = Camera.main.transform;

void Update () {

	if (Input.GetButtonDown ("Fire1")) {

		start = !start;


		cc.velocity = transform.forward * forwardSpeed;




Well, you need to set the velocity back to zero, right? I don’t see where you do that. cc.velocity remains at the last value before clicking. btw, I wouldn’t set the velocity of a rigidbody directly.

Have you tried changing

cc.velocity = transform.forward * forwardSpeed;


cc.velocity =;

and adding

cc.angularVelocity =;

or you could also try

cc.isKinematic = true

Read This