public void ShootStone() { if (!passedTheLine) { canShoot = false; canControl = false; // apply our current velocity to the stone stoneClone.rigidbody.AddForce(rigidbody.velocity * DEFAULT_FORCE); SwitchState(GameManager.eGameState.eRock); //switch to rockCamera which follows the stone stoneClone.Fire(); //this will call StoneFired() when the stone stops moving StartCoroutine(AllowRockToPassCameraBack()); } }
public void ShootStone() { //stoneClone.transform.parent = null; SwitchCamera(GameManager.eGameState.eRock); Vector3 forwardForce = transform.forward; forwardForce.x *= rigidbody.velocity.magnitude * 100f; forwardForce.y *= rigidbody.velocity.magnitude * 100f; forwardForce.z *= rigidbody.velocity.magnitude * 100f; //stoneClone.rigidbody.velocity = rigidbody.velocity; stoneClone.rigidbody.AddForce(forwardForce); stoneClone.Fire(); canShoot = false; canControl = false; // must be at the end StartCoroutine(StoneFired()); }