Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > irrKlang
Problems getting 3d positioning working in isometric game

cliffski
Registered User
Quote
2018-06-17 12:13:00

Hi there!
I'm currently making an isometric game (www.positech.co.uk/productionline) And using irrklang 32bit 1.6

My 3d placed sound volumes seem wrong, even random, and I think its because I'm misunderstanding the coordinate system. I've experimented a lot but got nowhere!

What I want is obviously L/R panning, and sounds getting louder as I zoom in.

when I place a sound in the game, the Z position is always 0 (ground level).
Here is my listener code:


float zpos = 220.0f - (200.0f * GUI_GetCamera()->GetRelativeZoom());

vec3df position(focus.X, focus.Y, zpos); // position of the listener
vec3df lookDirection(0, 0, -1.0f); // the direction the listener looks into
vec3df velPerSecond(0, 0, 0); // only relevant for doppler effects
vec3df upVector(0, 1, 0); // where 'up' is in your 3D scene

PEngine->setListenerPosition(position, lookDirection, velPerSecond, upVector);


Objects are placed in my isometric world in an x,y location, and that bit seems to work ok, its just the Z axis that confuses the hell out of me :D

A single tile in my world is 512.0f width. I'm not sure what units irrklang is using, is it meters.
My current rolloff and other settings are:

PEngine->setRolloffFactor(0.25f);


psnd->setMinDistance(30.0f);


I'm hoping that sounds will be heard maybe 5 tiles away from their source.
Any advice on the correct settings is very much appreciated.


niko
Moderator
Quote
2018-06-17 19:13:56

Hi,

from just looking at this, I think your "upvector" should be (0,0,1), since the last coordinate seems to be "up in your world, right?

Alternatively, you could also just flip the y and z coordinate of your sound and listener positions and keep that upvector.

Also, if this still has problems, try setting the look direction to something lik (0.001, 0.001, -1.0f) instead, since some audio drivers seem to have a problem with a line going into the other direction of the upvector.

Hope this helps! Good luck with your game!


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "I?ternational" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact