I have a parent/child object structure.
I’m positioning the child so it always sits on the vector between the parent and the camera.
The following code is attached to the child.
Vector3 diff = Camera.main.transform.position-this.gameObject.transform.parent.position;
Vector3 unitVector = Vector3.Normalize (diff);
this.transform.localPosition = (10f * unitVector);
If I rotate the parent, this child is no longer between the camera and the parent.
So, I thought all I’d need to do would be to rotate the unit Vector by the rotation applied the parent or, rotate the child back by this angle.
I was wrong.
I’m unsure as to why this wouldn’t work?