I am having problems with a plane child of an empty parent (aim) not rotating correctly. I hope it is my fault or I will be a little disappointed.[3521-child+rotation.jpg|3521]
The cyan line is “Debug.DrawRay(aim.transform.position, aim.transform.forward, Color.cyan);”. The plane can be seen to lie above the ray when looking up and will be below when looking down. When looking straight forward the plane is in the correct position. When looking straight up or down the plane will again be on the ray. There is no code manipulating the plane.
Edit: It was hard to se the plane transform in the picture, it is x = 0, y = 0, z = 0.6.
I am very grateful for your help and interest. I am at work and can not at this time paste any code. The lower cross hair is a Draw.Texture in GUI, it is behaving correctly. The top cross hair is the texture on the plane that is a child of the empty game object aim, positioned exactly at the main camera position.
I can not tilt the GUI texture (around the forward axis) so I figured I’d draw a texture on a plane that could be tilted with a transform.localEulerAngles, but I found this problem, and now instead use a circular cross hair in GUI. That way it does not look stange when the gun tilts but not the cross hair.
The problem arises when I rotate aim with (if I remember) aim.transform.eulerAngles(mouseY, 0f, 0f). The plane rotates with its parent aim, but not exactly. At straight angles it is on the forward ray but on oblique angles it lies above or below the forward ray.
I do like unity but find it has a mind of its own. Unity does pequliar things that are not intuitive to me, and in worse cases are not consistent. Most of the methods work intuitively and consistently. My solution is to learn and use only those that behave consistently, and wich ones to avoid. Or maybe, as I progress and learn more, I will find that they are all good in their own way.
What I want to know is if others also have also found unity to act strange in any way that forces you to work around a useless method?
I just realized, this started as a question, but I turned it into something that does not belong here but in the forums. For that i apologize. Feel free to delete question.
I somehow missed the later answers.
Seth, Thank you for that information, since it works for you I will not give up just yet. I actually do hope it is my fault so that when I learn what my error was it will be all good. And thank you for understanding exactly what my problem was and answering that question.
On a side note, I am happy now. It is 2:30 am and I just finished connecting a PID to control the player capsule and finally got the feel I wanted.
It seems the post where I thank Seth for understanding the question is lost. The answer to the problem is that the capsule was not scaled the same in all axes.