# 3D - Working out x,y,z coordinates

**URL:** <https://forum.kirupa.com/t/3d-working-out-x-y-z-coordinates/298996>\
**Category:** flash\
**Created:** [October 28, 2009, 11:02am UTC](https://forum.kirupa.com/t/3d-working-out-x-y-z-coordinates/298996 "2009-10-28T11:02:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nasher268](https://avatars.discourse-cdn.com/v4/letter/n/977dab/32.png) [@nasher268](https://forum.kirupa.com/u/nasher268)\
**Post date:** [October 28, 2009, 11:02am UTC](https://forum.kirupa.com/t/3d-working-out-x-y-z-coordinates/298996/1 "2009-10-28T11:02:51Z")

</div>

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:

```auto
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.
