Hi, Robert .
First of all, thank you for your interest and answer.
I'm rendering using osg::Light and osg::LightSource with a spotlight pointing down.
The exact position is set using light->setPosition()
The direction of the light is set with the code below.
osg::vec3d world =world + osg::Vec3d(0.0, 0.0, -0.6)
light->setDirection(-world)
However, if the camera's heading is rotated in the current implementation, the light currently being rendered in front is stopped at the position and only the camera rotates.
I want to rotate the position of the light along with the heading of the camera.
However, if you adjust the Direction value to rotate the position of the light, the rendered position will be distorted without rotating as desired.
So, I tried various things using the code below, but I didn't get the desired result.
osg::PositionAttitudeTransform *_pat = new osg::PositionAttitudeTransform();
osg::Quat ori = osg::Quat(osg::DegreesToRadians(0.0), osg::Vec3(0, 1, 0)) *
osg::Quat(osg::DegreesToRadians(0.0), osg::Vec3(1, 0, 0)) *
osg::Quat(osg::DegreesToRadians(heading_value), osg::Vec3(0, 0, 1));
_pat->setAttitude(ori);
Is there a good way to adjust the position of the light like a camera?