In this video we are continuously using Raycasting to determine a “Hit Point” for our mouse. The Camera is used as a source for the Raycast and also for its internal Class Function “ScreenPointToRay()”. This function allows us to convert a 2D mouse position into a projected 3D world point for our Raycast.
When we find our level Hit Point, we then adjust its height so as to match the player’s height and then use the player’s transform to Rotate towards or “LookAt()” the position.
Enjoy and please feel free to comment!