Question by
KasaiNeko42 · Apr 15, 2017 at 06:25 AM ·
2dtechnical
Disappearing player?
Hi guys, I'm a game dev who's trying to learn Unity. I'm porting my first ever complete Scratch game into unity, and I encountered a little problem.
I'm trying to make the bow aim towards the mouse pointer. I tried doing this:
transform.LookAt (Input.mousePosition);
...but the bow disappears when I hit play.
I am almost certain I did something wrong, but what did I do wrong?
If it helps:
This is a 2D project
I'm attempting to recreate the "point towards mouse-pointer" block in Scratch.
Comment
EDIT: So I went into 3D mode and discovered that my bow was tilted along some axis that is not the Z axis, meaning that the mouse pointer and the bow did not have the same Z value. Is this the issue?
I edited the code and now it goes:
Touch touch = Input.GetTouch(0);
transform.LookAt (touch.position);