C# help with UniWii...

Hi,

I am currently trying to get the UniWii FPS example working. ( http://www.unifycommunity.com/wiki/index.php?title=UniWii#Version_history )

The example was downloaded and had to be upgraded for 2.6. Now when I initially ran it I had a few console errors about obsolete commands (AxisAngle should now be AngleAxis). I swapped these around and am now getting:

Assets/Standard Assets/Camera Scripts/MouseLook.cs(175,77): error CS1502: The best overloaded method match for UnityEngine.Quaternion.AngleAxis(float, UnityEngine.Vector3)' has some invalid arguments* *Assets/Standard Assets/Camera Scripts/MouseLook.cs(175,77): error CS1503: Argument 1: Cannot convert type UnityEngine.Vector3’ to `float’

The C# that has the error is written as follows:

if (axes == RotationAxes.MouseXAndY)

  • {*

  • // Read the mouse input axis*
    _ rotationX += Input.GetAxis(“Mouse X”) * sensitivityX;_
    _ rotationY += Input.GetAxis(“Mouse Y”) * sensitivityY;_

  • rotationX = ClampAngle (rotationX, minimumX, maximumX);*

  • rotationY = ClampAngle (rotationY, minimumY, maximumY);*

Quaternion xQuaternion = Quaternion.AngleAxis (Vector3.up, Mathf.Deg2Rad * rotationX);
__ Quaternion yQuaternion = Quaternion.AngleAxis (Vector3.left, Mathf.Deg2Rad * rotationY);__

_ transform.localRotation = originalRotation * xQuaternion * yQuaternion;_

Bolded lines giving me the error.

I have read about having to add “out” but cannot seem to fiddle this in to work. My programming skills leave a lot to be desired.

Any input would be greatly appreciated please.

The out keyword is only used with functions that have out parameters (like Quaternion.ToAngleAxis) and not in your case (Quaternion.AngleAxis). You justed mixed up the parameters: the first one should be the angle, the second the axis, you have it the other way around ;).