Advertisement Jump to content
Sign in to follow this  
Dre767

3D Sound with FPS controls

This topic is 4877 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

Im having some trouble on setting the position on the listener for the sound depending on your position and the direction you are facing...
for example... *S* = sound position *Y* = your position
 ---------------------------------------------------
|                                                   |
|                        *S*                        |
|                                                   |
|*Y*                                                |
 ---------------------------------------------------
as the player rotates on the spot the sound should be panning from speaker to speaker... and as the player moves around the sound there should also be panning
as the player rotates u could do something along the lines of this... //get the direction that the player faces... D3DXVECTOR3 direction = MyCamera->lookAtVector - MyCamera->positionVector; //get the direction that the player faces the sound... direction -= MySound->positionVector; //normalize direction... D3DXVec3Normalize(&direction,&direction); //that handles the direction... //now i need to do something with the position? . . //stuff here . . MySound->listenerPositionVector = ?
maybe im using the wrong approach... any suggestions?

Share this post


Link to post
Share on other sites
Advertisement
In an FPS, the camera is the listener, so the listener's direction is the camera direction and the listener's position is the camera's position. In other words:
    pListener->SetOrientation( MyCamera->lookat.x, MyCamera->lookat.y, MyCamera->lookat.z,
MyCamera->up.x, MyCamera->up.y, MyCamera->up.z,
DS3D_DEFERRED );
pListener->SetPosition( MyCamera->position.x, MyCamera->position.y, MyCamera->position.z,
DS3D_DEFERRED );
pListener->SetVelocity( MyCamera->velocity.x, MyCamera->velocity.y, MyCamera->velocity.z,
DS3D_DEFERRED );
pListener->CommitDeferredSettings();

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!