Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void moveMesh()
- {
- if (Input.GetMouseButtonDown(0))
- {
- mouseClickPos = Input.mousePosition;
- }
- if (Input.GetMouseButton(0))
- {
- screenPoint = Camera.main.WorldToScreenPoint(myMesh.transform.position);
- Vector3 mouseOffsetAmount = mouseClickPos - Input.mousePosition;
- Vector3 cursorPoint = new Vector3(screenPoint.x+mouseOffsetAmount.x, screenPoint.y+mouseOffsetAmount.y, screenPoint.z);
- Vector3 finalPos = Camera.main.ScreenToWorldPoint(cursorPoint);
- myMesh.transform.position = finalPos;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement