- Home /
Synchronizing two cameras.
Hi there, I'd like to synchronize two cameras (want to make them displaying this same thing), how to do that? I have tried:
// kierunek = Quaternion.Euler (new Vector3(kameraGracza.transform.rotation.x, kameraGracza.transform.rotation.y,kameraGracza.transform.rotation.z));
//transform.rotatioW n = kameraGracza.transform.rotation;
//transform.position = kameraGracza.transform.localPosition;
this.transform.localRotation = kameraGraczPOS.localRotation;
//this.transform.localPosition = kameraGraczPOS.localPosition;
//transform.localRotation = Quaternion.Euler(new Vector3(0,0,kameraGracza.transform.localRotation.z))*Quaternion.Euler( new Vector3(kameraGracza.transform.localRotation.x,0,0));
but any thing worked. Any ideas/help?
Parent one camera onto the other...???
Your description is far from descriptive, please elaborate, thanks :)
O$$anonymous$$. I have two cameras in one object, but they are already in different parents so I can't parrent them. I'd like to change the position and rotation of camera B to pos and rot of camera A every frame. How to do it?
What do you mean by "I have two cameras in one object" ?
I ask as you then go on to say that "they are already in different parents" which seems somewhat contradictory to your first statement...?
The first camera is the player camera, the second one is a scope camera, placed on a weapon and now I want this scope camera to show what is the player camera showing. Sorry for bad English.
Answer by Bunny83 · Dec 20, 2014 at 03:07 AM
This should do what you want. Keep in mind that the cameras could have different settings (field of view, ...)
void LateUpdate()
{
transform.rotation = kameraGracza.transform.rotation;
transform.position = kameraGracza.transform.position;
}
Note: This won't work if one or both of the camera's parent has a scale of 0 on any axis. This would prevent your object to be repositioned as you can't multiply 0 with any meaningful value to get a value different from 0. Just in case.
Your answer
![](https://koobas.hobune.stream/wayback/20220613174449im_/https://answers.unity.com/themes/thub/images/avi.jpg)