Vector Quaternion Conversion

When I try to multiply the transform.rotation by a Vector, I get the error message "Cannot implicitly convert type ‘UnityEngine.Vector3’ to ‘UnityEngine.Quaternion’. Not sure how Sam was able to do it.

I had the same trouble at the start. That is because you are probably assigning the result to a Quaternion variable like so;

    Camera camera = GetComponentInChildren<Camera>();
    camera.transform.localRotation = camera.transform.localRotation * Vector3.forward;

Have a think about what the result needs to be assigned to. We are no longer dealing with the camera’s rotation. We are rotation the firing of the ball to match the camera’s rotation. So we are assigning the result of the Quaternion * Vector3 to the rb.velocity like so;

        rb.velocity = camera.transform.rotation * Vector3.forward;

Don’t forget to re-apply your ball speed though.

        rb.velocity = camera.transform.rotation * (Vector3.forward * ballSpeed);

Privacy & Terms