Problem with Quaternion.ToAngleAxis() in C#

Hi,

I tried to use Quaternion.ToAngleAxis() in a C# script, but for some reason the code doesn’t even compile.

My code looks like this:

void calc()
{
	float angle = 0;
	Vector3 axis = Vector3.zero;

	transform.rotation.ToAngleAxis(angle, axis);
}

I basically got the template from the script reference, the compiler comes back with this message:

Is there a way to get around this? Am I doing something wrong? Basically I need to get the look vector of an object.

Cheers!

try this:

void calc()
{
   float angle = 0;
   Vector3 axis = Vector3.zero;

   transform.rotation.ToAngleAxis( out angle, out axis);
}

Thanks bronxbomber92, it works fine now!

I also just found out that this is the standard way to pass output parameters in C#, should’ve looked…