Vector3 v3Pos = new Vector3(Input.mousePosition.x, 10, Input.mousePosition.y);
v3Pos = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y-30,10));
a.rigidbody.position = new Vector3(v3Pos.x, v3Pos.y-30, v3Pos.z);
I’m trying to make a game where the camera looks down on a flat plane and the player moves the mouse(thus moving a pen) to draw. I’ve tried a number of ways to get the pen to follow my mouse, but then have them have worked. With my current code the pen can only be moved through a small area in the center of the screen. I need to be able to move my pen anywhere on the screen without it flying to the very edge of the game world. Any advice?
Also, for clarification. I only want the pen to move in the x and z position. I want it to remain locked in its set y position.