I need help desperately. Please take a moment.

classic Classic list List threaded Threaded
3 messages Options
newlife958 newlife958
Reply | Threaded
Open this post in threaded view
|

I need help desperately. Please take a moment.

I basically implemented a spot light by referring to the osgLight sample.

In this state, I want to implement the light to illuminate the ground while rotating 360 degrees in place after moving the illuminated part of the light, but I can't really get a sense of how to do it. The implementation is as follows.
_p.set(osgEarth::SpatialReference::create("wgs84"), _position->longitude, _position->latitude, _position->altitude, osgEarth::ALTMODE_ABSOLUTE);
_p.toWorld(world);
_instance->setPosition(worldToVec4(world));

world.normalize();
_instance->setDirection(-(world + osg::Vec3d(0.0, 0.0, -0.7)));

What value should be put in the direction of the light to rotate 360 degrees?
Really... the rotation doesn't work as expected, so I think my hair is going to be damaged...
Help.
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|

Re: I need help desperately. Please take a moment.

newlife,
I don't understand what you are trying to do. Can you explain it a different way?
Glenn Waldron / Pelican Mapping
newlife958 newlife958
Reply | Threaded
Open this post in threaded view
|

Re: I need help desperately. Please take a moment.

Hi , Glenn.
Have a nice day!.

================================================

_p.set(osgEarth::SpatialReference::create("wgs84"), _position->longitude, _position->latitude, _position->altitude, osgEarth::ALTMODE_ABSOLUTE);
_p.toWorld(world);
_instance->setPosition(worldToVec4(world));

world.normalize();
_instance->setDirection(-(world + osg::Vec3d(0.0, 0.0, -0.7)));

===================================================
With the code above, the light is tilted along the z-axis to illuminate a location slightly away from the front.

When the camera is rotated in this state, I want to implement the light to rotate while moving with the camera.

However, even if you apply various rotation methods, it rotates with the camera to some extent and then moves forward in a different direction at some point.

Can you tell me what value should be entered for the light's Direction to make the light rotate 360 degrees like a camera and eventually return to its place?

I've been trying to rotate the light for over a month, but I haven't found it yet.
Hair loss will come while thinking to solve this problem.

Anything is fine, so please give me some advice on how to fix it.