Hi ! I'm trying to create a flashlight beam effect (A Custom geometry quad always facing the camera)
The problem is i need to rotate this beamNode only on z axis and leave the other axes untouched.
No matter how i tried so far sometimes it works but if i rotate the flashlight in some direction the up axis is changing and i don't know how to calculate it.
This code works if the flashlight has 0,0,0 rotation
Vector3 p = camNode.position - beamNode.get_worldPosition();
p.z = 0.0f;
q.FromRotationTo(p , Vector3(0,1,0));
beamNode.rotation = q;
// small correction needed :
Vector3 r = beamNode.rotation.get_eulerAngles();
r.z = 360.0f - r.z;
beamNode.rotation = Quaternion(r.x , r.y , r.z);
Once i rotate my flashlight in some direction the beamNode rotation is wrong