Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Moving lights..

This topic is 5498 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

When adding a point light to a device in which space does it end up? If i set the postion of the light and set it each frame like this: m_pLight.Position = m_vecBalltranslation; m_pd3dDevice->SetLight(1,&m_pLight); m_vecBalltranslation is a position vector. Nothing happens, so i figured that i have to translate some matrix somewhere but i can''t figure out which one. What i want to do is to make a point light follw a sphere much like in the LightningVS sample in the SDK. In the sample, as i understand, they move the world around the light. I want to move the light around in the world as if the light is a mesh. Since i am new to DirectX there is a great possiblity that i have missunderstood the entire lights concept, but i any help is appriciated. /Tjackman.

Share this post

Link to post
Share on other sites
There''s a function that applies a matrix to a vector. That''s what you want. I think the functions D3DXVec3Transform.

Apply the same matrix to a vector and store the result all the time or keep building a new matrix that''s rotated a bit more and apply that to the start point.

Hope that helps


Share this post

Link to post
Share on other sites
I had the same problem before. To fix it you can do this:

m_pLight.Position = m_vecBalltranslation;
m_pd3dDevice->LightEnable(1, false);
m_pd3dDevice->LightEnable(1, true);

Now you are turning off that light, updating its position and turning it on again. But I don''t know why you have to do it this way, maybe someone else can answer it.

Hope that helps.


Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!