Trying To create a crosshair that follows mouse movement and is confined to a spherical area around the 3rd person player character, Sphere repesents sword length

Trying To create a crosshair that follows mouse movement and is confined to a spherical area around the 3rd person player character. Sphere represents sword length. any tutorials or tip would be appreciated (NOOB Warning)

What is player setup? Its top down, first person 3rd person or VR?
Because for each type you set it up a bit differently.

Most generic way:

  • read mouse pointer location on screen
  • calculate where it points in 3d space
  • calculate vector from camera (or player) to that location where mouse points
  • normalize that vector and multiply by sphere radius. You got point in 3d

Now problem is how you find where mouse points to. And this entirely depends on how you setup game: FPS, 3rd person or top down.

View similar to diablo 2, wide view of surroundings but lower angle more 3rd person view.

Thanks for feed back