Hello,
I currently have 2 cameras; 1 perspective and 1 orthographic. I made a script that lets the user draw on the screen. I have zero experience with cameras so it’s really hard to explain :
My problem: When I draw, it draws on the screen of the ortographic camera and not on the perspective one.
visual:
code:
public Camera camera;
// Update is called once per frame
void Update ()
{
var pos = camera.ScreenToWorldPoint(Input.mousePosition);
print(pos + "--" + Camera.main.ScreenToWorldPoint(Input.mousePosition));
pos.z = camera.transform.position.z + 5;
transform.position = Vector3.Lerp(transform.position, pos, Time.deltaTime);
}
void OnMouseDown()
{
gameObject.renderer.enabled = true;
}
EDIT: So while working on something else, apparently I moved my ortho camera. When I tried drawing again this morning, it worked a lot better than yesterday. I guess it didn’t work yesterday because the position of my ortho cam was off. It now looks like this: http://i46.tinypic.com/o5nd3b.png
I have another question though. The lines I draw actually go through the gameobject I have placed in my scene (http://i50.tinypic.com/2uohnk0.png). How can I draw them in front of the objects without changing the z-axis of where they are drawn (because changing z-axis makes the line wider / thinner).