I am doing a tutorial on CG cookie. the script is all in Javascript and I thought It would be a good exercise to try to write the same code in C#, I got stuck on implementing this function though. In Javascript it is:
`function CalculateAimPosition(targetPos : Vector3)
{
var aimPoint = Vector3(targetPos.x + aimError, targetPos.y+aimError, targetPos.z+aimError);
desiredRotation = Quaternion.LookRotation(aimPoint);
}`
I am trying to write this in C# since my C# skills need work. I tried:
void CalculateAimPosition (Vector3 targetPos)
{
aimPoint = Vector3(targetPos.x + aimError, targetPos.y+aimError, targetPos.z+aimError);
desiredRotation = Quaternion.LookRotation(aimPoint);
}
I get an error that says ‘void’ cannot be used in this context. I know I am doing something wrong but I can’t quite figure out what.