I am working on a function that will convert a theoretical 3d point into x and y coordinates on the screen. But I need to know where the 3d point is in relation to the camera.
My question is: How would I work out the position of a theoretical 3d point in relation to the camera’s x, y and z coordinates and the cameras pitch, roll and yaw?
It would be in the form of a function like this:
convert3Dto2D = function(pointIn3D:Object) {
//pointIn3D has x, y and z variables
3d.x = ????? //this is the x in relation to the camera
3d.y = ????? //this is the y in relation to the camera
3d.z = ????? //this is the z in relation to the camera
2d.x = //This section I already know but it needs 3d's x, y and z
2d.y = //This section I already know but it needs 3d's x, y and z
return 2d
}
I am using flash 8 by the way.