# Position from rotation problem.

I have a question I searched about and couldn’t find. Sorry if there is already an answer. So, I have a GameObjet that is a wall that can have a rotation over the Y axis. In the script of this object, I have a node that can move around ( technically the player ). I want to find the position in X,Y,Z relative of the wall to the node. It already works if the Y rotation is 0. With those informations I want to display another node that is symtrical to the node on the other side of the wall. But I don’t want it to be like a mirror. Right on one side of the wall is also right on the other side. I can show my code and I also know where I need to change the code, because it’s already working, but not when I change the Y angle. Sorry but my variables are in french. Thanks for any help.

``````var cameraRelativeMur = objMurLiaison.transform.InverseTransformPoint( objCameraJoueur.transform.position );
cameraRelativeMur = cameraRelativeMur + Vector3( 0, -1 * cameraRelativeMur.y, -1 * cameraRelativeMur.y );
print( 'rel : ' + cameraRelativeMur );

// The 3 next lines are the one to change
// À modifer pour être en lien avec la rotation
var distanceX = 1 * ( positionPointMur.x - objCameraJoueur.transform.position.x );
var distanceY = 1 * ( positionPointMur.y - objCameraJoueur.transform.position.y );
var distanceZ = 1 * ( positionPointMur.z - objCameraJoueur.transform.position.z );

print( 'abs : (' + distanceX + ',' + distanceY + ',' + distanceZ + ')' );
var distXRel = ( distanceX * objMurLiaison.transform.right );
var distYRel = ( distanceY * objMurLiaison.transform.forward );
var distZRel = ( distanceZ * objMurLiaison.transform.up );

var distRel = distXRel + distYRel + distZRel;

transform.position = objMurLiaison.transform.position + distRel;

var directionSym = -1 * ( ( nodeObjCameraJoueur.transform.position ) - objCameraJoueur.transform.position );
directionSym -= Vector3( 0, directionSym.y * 2, 0 );
transform.rotation = Quaternion.LookRotation(directionSym);
``````

If your wall is symmetrical around the pivot, can’t you just rotate 180 degrees. That is, you place your second ‘node’ at the same position as the first and then do:

`````` transform.RotateAround(wall.position, wall.up, 180);
``````