How to fix directional billboard?
Hello,
I've these two scripts:
1st. https://gist.github.com/jksa13/17a6e8a2b7bdacb99d2d7c7873dfece4
and
2nd. https://gist.github.com/jksa13/48defd1ccf5426dfeb7ca68322e96e2c
Both of them have been applied to a quad, but the thing is that the billboard is facing away from the camera :/
And if I change line 13 (in the first script) to "lookAtTarget = transform.position - Camera.main.transform.position;" or change line 21 to "transform.LookAt(lookAtTarget);" which seems to give the same result, but even though it fixes that the quad faces towards the camera, the issue is then that it doesn't follow the camera properly anymore, meaning that it doesn't follow all the way after the camera anymore, which is did before, but just facing away from it.
Any suggestions as how to fix this? Because I'm very lost >_>
EDIT:
As for the second script goes, there is also something really wrong when with the second script...
the idea is that I want to do something like in the original doom where all the enemies have 8 sprites depending on which way they look, but if i make the size of the "public Texture2D[] Textures;" 8 then I get this result (see the one to the left): https://postimg.org/image/gc7sit4u7/ and if i make it size of 4 then i get the one to the right of the picture.
The line at 4 in the left and the line at 2 in the right one, is supposed to be the front, but it should be something that shows for 45 degrees in front of the camera, but instead that one is just 1 pixel (1 degree i guess).
And for some reason in the picture to the left, a size of 8 just replicates the ones of the other side, like 1 is 1 to both the left and the right, it should have been its own element...
I've no idea how to fix this :/
Your answer
Follow this Question
Related Questions
Help with billboarding 0 Answers
"Lookat" only working in one case 0 Answers
Unity lookat at finger position 3D C# 0 Answers
How to make billboard light in unity 5? 0 Answers
Player facing mouse with orthographic isometric camera 0 Answers