# Make real world frame position to position relative to rotation

I’m in a project in which I have an external sensor which gives me the pitch, roll and yaw of the object as well as its position in real life coordinate frame x, y, z in a script that I have attached to the main camera. I have succesfully implemented the rotation as: transform.rotation = Quaternion.Euler(rotationPitch, rotationYaw, rotacionRoll);

However, for the position, If I do: v3pos = new Vector3(position[0], position[1], position[2]); transform.position = v3pos;

It kinda works but only If I have my real object facing front, if for example I turn it 90º to the left and then move it “forward”, in reality is to the left in real world frame, it moves the camera to the left, and not forward as I would want.

How do I do this change?

I’m not following what part of this is related to Unity physics? It seems you’re just asking a scripting question about Transforms, Camera etc.

The scripting forum is here.

Sorry, will create it there, I put it here since it is physics related but maybe not unity physics.

If it’s physics related leave it here. I don’t understand the distinction between physics and unity physics.

If you mean the physics of movement or geometry then no, that’s not what this forum is really about. It’s about the components for 2D/3D physics i.e. Box2D or PhysX components i.e. rigidbodies, colliders, joints, contacts, callbacks, queries etc. Not really about how to manipulate Transforms etc.

It sounds like above you want to use Transform.forward which is calculated in the local space of the Transform but as I mentioned above, not physics.

About Transform.forward, I had been playing a bit with it but couldn’t make it work perfectly since each frame I have the real life position not the speed, also I think I explained it a bit better in the other thread.