I have a 3d model of a room and I know the coordinates (Vector3’s) of 4 points in that room, 3 reference points and 1 point we will call pointOfInterest.

In unity I am able to get the coordinates (Vector3’s) of those 3 reference points but the orientation/rotation is different to that of the 3d model. The scale is fine. What I am trying to do is find where the pointOfInterest would be in the unity coordinate system based on the 3 reference points in unity relating to the 3 reference points in the 3d model and knowing where the pointOfInterest is in relation to the 3 reference points in the 3d model - direction and distance.

I have looked into using Vector3.RotateTowards(), Vector3.Angle() and a little bit into Quaternions but I can’t seem to grasp the exact methods I need to use to solve this. A point in the right direction would be great and some example code (C#) would be amazing!

Key things to note:

- Goal is to find the Vector3 of pointOfInterest within unity
- Reference points in the 3d model map to the reference points in unity
- ReferencePointA in 3d model is equal to ReferencePointA in unity
- ReferencePointB in 3d model is equal to ReferencePointB in unity
- ReferencePointC in 3d model is equal to ReferencePointC in unity

- In the 3d model we can figure out distances and directions between each reference point and pointOfInterest

This has been solved so I am putting my solution here in case anyone else runs into the same problem.

I had to put ReferencePointA → ReferencePointB as a line/direction along the Z-Axis and ReferencePointB → ReferencePointC as a line/direction along the X-Axis. Then I calculated how far down each line each point was and then used the distance and direction to calculate where the point was. Here is the code in case anyone wanted it:

```
private Vector3 Convert(Vector3 vecToConvert)
{
Vector3 vecToReturn = new Vector3();
//Find how far down the X axis the point is from refPointBModel -> refPointCModel. Gives refXDis.
float modelBX = refPointBModel.x;
float modelCX = refPointCModel.x;
float refXDisBC = modelCX - modelBX;
float refXDis;
float transX = vecToConvert.x;
//This determines which way the x-axis goes from B -> C
if (refXDisBC > 0)
refXDis = transX - modelBX;
else
refXDis = revitBX - transX;
//Find how far down the Z axis the point is from refPointBModel -> refPointAModel. Gives refZDis.
float transZ = vecToConvert.z;
float modelBZ = refPointBModel.z;
float refZDis = transZ - modelBZ;
//Get the X coordinate based on how far between refPointBLocal -> refPointCLocal refXDis is. Gives xPoint.
//Get direction of refPointBLocal -> refPointCLocal.
Vector3 xDirection = (refPointCLocal - refPointBLocal).normalized;
//Use distance and get X coordinate.
Vector3 newXSpot = refPointBLocal + (xDirection * refXDis);
//Get the Z coordinate based on how for between refPointBLocal -> refPointALocal refZDis is. Gives zPoint.
//Get direction of refPointBLocal -> refPointALocal.
Vector3 zDirection = (refPointALocal - refPointBLocal).normalized;
//Use distance and get Z coordinate.
Vector3 newZSpot = refPointBLocal + (zDirection * refZDis);
//Calculate Y Axis.
float transY = vecToConvert.y;
float modelBY = refPointBModel.y;
float refYDis = transY - modelBY;
float newYCoordinate = refPointBLocal.y + transY;
Vector3 result = (newXSpot + newZSpot) - refPointBLocal;
vecToReturn = new Vector3(result.x, newYCoordinate, result.z);
return vecToReturn;
}
```