I've been trying to write some code to convert an objects position from world coordinates into the cameras local coordinates. the camera can rotate around x and y axes.
This would then allow me to calculate pan and depth values for a sound coming from said object by just taking the x and z lengths.
In pseudo code I have been doing this.
newpos = object.pos - camera.pos
object.rotatexyz(newpos,-camanglex,-camangley,-camanglez)
However this doesn't work. What am I doing wrong?
This would then allow me to calculate pan and depth values for a sound coming from said object by just taking the x and z lengths.
In pseudo code I have been doing this.
newpos = object.pos - camera.pos
object.rotatexyz(newpos,-camanglex,-camangley,-camanglez)
However this doesn't work. What am I doing wrong?