20-08-2020, 07:41 PM
I come back to this thread and try to give better examples. See images.
With tilted camera hook attaches to different points in z-depth if I click lower or higher (I don't click the object..).
When camera is not tilted hook attaches always to same z-depth.
// Get the mouse position in the scene, in the same XY plane as this object:
Vector3 mouse = Input.mousePosition;
mouse.z = transform.position.z - Camera.main.transform.position.z;
Vector3 mouseInScene = Camera.main.ScreenToWorldPoint(mouse);
Maybe I have misunderstood how this script should work when it calculates the attach point.. Does it affect the screen point calculations if user clicks on the "sky"?
With tilted camera hook attaches to different points in z-depth if I click lower or higher (I don't click the object..).
When camera is not tilted hook attaches always to same z-depth.
// Get the mouse position in the scene, in the same XY plane as this object:
Vector3 mouse = Input.mousePosition;
mouse.z = transform.position.z - Camera.main.transform.position.z;
Vector3 mouseInScene = Camera.main.ScreenToWorldPoint(mouse);
Maybe I have misunderstood how this script should work when it calculates the attach point.. Does it affect the screen point calculations if user clicks on the "sky"?