- Home /
This post has been wikified, any user with enough reputation can edit it.
Question by
Rystuff · Nov 28, 2014 at 01:54 AM ·
2d-platformer
UnExpected token Please help
I'm making a 2D shooter but I want the arm to rotate on my sprite. The Script I have has a few errors I can't find, Please help her's the script below.
public class ArmRotation : MonoBehaviour {
public int rotationOffset = 0;
// Update is called once per frame
void Update () {
Vector3 mousePos = Input.mousePosition;
Vector3 pos = Camera.main.WorldToScreenPoint(transform.position);
mousePos = mousePos - pos;
transform.rotation = Quaternion.Euler(new Vector3(0, 0, Mathf.Atan2(mousePos.y, mousePos.x) * Mathf.Rad2Deg - rotationOffset));
}
}
Comment
Your answer