As usual, I didn’t use the simplest way. In this case in determining the pivot point for camera rotation, as mentioned in my previous post.
Previously I used raycast to determine the pivot point, and then rotate the camera around it.
Then I realized that I can just make an empty game object as a fixed pivot point and put it as a child of the camera. So whenever the camera moves, the pivot point stays in the same distance in front of the camera.
No more wasteful raycasting!
Leave a comment