1st to 3rd person crosshair?
Hello, I'm a bit stuck on my interface. It works just fine in 1st person, but when I switch cam to 3rd person my crosshair gets completely useless, as the player no longer shoots towards the crosshair like he does in 1st person. And I don't really know what to do in order to fix this... The way I've set up the 1st person crosshair, is just that I've made a canvas and tossed in a crosshair at the middle of it. But that doesn't really work for my 3rd person view... any ideas how to fix this or at least is there a better way to go about this, so that it would work for both 1st and 3rd person view? Thanks :)
EDIT: maybe I should do it in a different way if I want it to work for both 1st and 3rd person? I just want a crosshair, that is in the middle of the screen, that when shooting from either 1st or 3rd person camera, shots towards that area/spot where the crosshair is :)
Maybe Canvas is bad way going about doing this???
Answer by KdRWaylander · Dec 21, 2015 at 03:31 PM
Hi,
You'll have to transpose to your case (don't attach it to your cam but to your character) but this is one good way to make a crosshair !
Right now I haven't attached it to anything, I just have the Canvas in my Hierarchy and then the crosshair is a child of that canvas.
So I guess it's sorta just lying on top of the screen, you know? Like if it's a transparent image that is just put over the scene of the game.
EDIT: maybe I should do it in a different way if I want it to work for both 1st and 3rd person? The video you linked me doesn't seem to do what I want. I just want a crosshair, that is in the middle of the screen, that when shooting from either 1st or 3rd person camera, shots towards that area/spot where the crosshair is :)
Don't use canvas to implement a reticle (crosshair), that's a wrong way of using canvas.
The video does show what you want to achieve, but indeed without using canvas. Here are the macro steps, see the video for details:
draw a crosshair on Gimp / Photoshop / ...
create a plane on which to put the crosshair, the crosshair is now an OBJECT in your scene
attach the reticle as a child of your player (and not to a cam like in the video)
script it as so the reticle is always facing the player and appears to have the same size all the time (raycasting and stuff, the script is in the video)
tweak a shader so the reticle is always rendered on top of everything (in the video again)
enjoy the possibilty of changing the active camera an still have the reticle since it's attached to your player hence no dependent on which camera your using to render the scene
Sorry about the late reply, but this doesn't work as I want it to; when I shoot with my spaceship in 3rd person, then the shots/laser doesn't fly according to the crosshair... any suggestions?
Your answer
![](https://koobas.hobune.stream/wayback/20220612053418im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Mechanim animation doesn't play 2 Answers
How do I show "Duration in" and "Duration out" for the transition graph in the inspector window 0 Answers
Mecanim: 2-step transitions in a single update (skip intermediate state) 0 Answers
Circle crosshair that fits the bullet spread 1 Answer
How do I make it so that my First Person Controller script allows for movement in all directions? 1 Answer