Hi all,
I have this slice of code in C# that i am trying to convert to js and i am having not much luck.
private Vector3 PiecePosition(Vector3 pos)
{
}
I have tried to convert it into a function in js like this.
private function PiecePosition (pos : Vector3) : Vector3
{
}
But now i have two other pieces of code that are throwing up errors and i think it might be because of that function i created.
This line of code has not been changed from the C# script.
activePiece.transform.position = PiecePosition((Vector2)piecePositions[activePiece.name]);
This line of code has been changed a bit.
C#
Vector3 dV = PiecePosition((Vector2)piecePositions[activePiece.name]) - activePiece.transform.position;
js
var dV : Vector3 = PiecePosition((Vector2), piecePositions[activePiece.name]) - activePiece.transform.position;
The error i am getting on the two lines of code is:
The best overload for the method ‘JigsawPuzzle.PiecePosition(UnityEngine.Vector3)’ is not compatible with the argument list ‘(System.Type, Object)’.
I think the problem lies in the code at the very top but i don’t know how to fix it.
Any help would be appreciated.
Thanks.