world coords into camera local coords

BlitzMax Forums/BlitzMax Beginners Area/world coords into camera local coords

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

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?