- Home /
Cast a cursor into world space from a game object?
I have a script that converts the mouse cursor into a point in the world space so that the player character can look at the mouse cursor using IK. It's pretty accurate, but when that character is aiming a gun, a ray casted from the gun position will hit slightly off from where the mouse cursor is aiming. This obviously isn't desirable for accuracy as far as gameplay is concerned.
I was wondering how I could cast a visible crosshair into the world space from the bullet launch position of a gun so that the player is aiming with a cursor that actually represents where the bullet will hit, rather than the slightly inaccurate mouse cursor.
Reading into it some, it seems the most common suggestion for something like this is to use either a projector or a spot light.
I'm assu$$anonymous$$g a spot light is computationally expensive, though and I've never used a projector before so I'm not sure on their performance impact. Which one of these would be more efficient?
Your answer
Follow this Question
Related Questions
Draw line using line renderer on mouse position wtihout "use world space" 2 Answers
While holding down the mouse button make object rotate to mouse cursor 1 Answer
Top down aim at mouse 3 Answers
Rotate player to aim on one axis (Z-axis) towards mouse position/joystick - 2.5D (3D) 0 Answers
Mouse aims at object ? 1 Answer