I’m having a small problem which I hope you can help me with. I have a sphere and I want it to act so that when I click on it the point I clicked rotates towards camera. Imagine it like a globe and when you click on New York then it is rotated towards camera.
I know I get the coordinates of the click from RaycastHit.point but the problem is that I somehow can’t sort it out how to do the math to get the rotation for the sphere.
Hope you got some ideas. Thanks!
one thing you could try is using RaycastHit.normal. The normal is a vector3 that points perpendicular to a plane (in this case, one of the triangles that make up that sphere).
Say something like camera.transform.position = raycastHit.point + (raycastHit.normal * distanceFromSphere);
Sorry i’ve been trying to figure this one out, but there seems to be no easy solution. There’s got to be a way to use lookrotation with a quaternion and finding the difference between the transform.forward and the direction from the center of the sphere to the surface contact point to the mouse.
No one else out there has any ideas? This one has stumped me.