Greetings JGO. This is sort of a general math question that ties into lwjgl/opengl please correct me if this is not the right board.
My problem is I’m trying to place a shape at a certain distance away from the camera in a spherical radius. Right now it works correctly for the x,z coords but the y is what I’m having trouble with.
What I’m trying to do is trying to create a point/cube 10m from the cameras current position in in any direction based on where i click. right now the code I’m using only works for the x,z axis no the y.
Above should hopefully show what I’m talking about
I know that i have to subtract the x,z coords by some amount, based on the pitch of the camera (as the y increases the z,x should be brought back) but i have no idea how to go about this.
float xr = RANGE * (float) Math.sin(Math.toRadians(-yaw));
float zr = RANGE * (float) Math.cos(Math.toRadians(-yaw));
float yr = RANGE * (float) Math.tan(Math.toRadians(pitch));
CubeGame.addCube(new Vector3f(pos.x - xr, pos.y - yr, pos.z- zr), 1);
here’s a pastebin of the full class for full context: http://pastebin.com/rApm19G6
Thanks for the help