// Set the position of the camera on the x-z plane to:
// distance meters behind the target
transform.position = target.position;
transform.position -= currentRotation * Vector3.forward * distance;
The last line syntax is a " quaternion * vector3 * double " which C# refuses to compile. So how to convert this line to C#?
That seems somewhat unlikely. Even if operator * is defined for two Vector3’s, regardless of what type of product it represented, the above would be unlikely to produce a meaningful result.
@The OP: Can you post the error message? (I think it’s likely that someone will be able to answer the question even without the error message, but it’s usually a good idea to post any error messages you get when something won’t compile.)
Thanks guy. I think that I managed to figure it out.
the two lines when converted to C# should look like this,
transform.position -= (Vector3)(currentRotation * Vector3.forward * (int)distance);
// Set the height of the camera
transform.position = new Vector3((float)(transform.position.x), (float)currentHeight, (float)transform.position.z);
First, the double “distance” will have to be cast into an integer.
Second, the original java syntax “transform.position.y = currentHeight” never works in C#. Rather I created a new Vector3() for it.
It looks like you have a couple of unnecessary casts there. Also, I would guess you’d want to cast ‘distance’ to a float rather than an int. (Or, just make it a float to begin with.)