hi,
I’m testing cinemachine, and there 1 issue I have is at some points while moving my character I want to switch between cameras (which have different properties) I do this by changing priority number… however, when I switch back… the camera that was switched off starts at the position it was switched off at and slowly returns behind my object… so my question how to switch between cameras while having both cameras stay in same positions that they should ?
Your vcams are of the “simple follow” variety, right?
In that case, they follow the player in their own way when active, and stay put when inactive. What you need to do is position the incoming vcam at the same point as the outgoing one, then activate it (activate its game object, don’t just change the priority number). So: position the deactivated vcam, then activate it and deactivate the outgoing vcam at the same time.
Not sure if those are different things but I’m using Transposer + Lock to target settings with the Virtual Camera. while moving player object during behavior change I simply want different damping values, so I switch between virtual cameras however when I switch back the newly switched on camera is not at the position it should be right away, it moves from the position it was switched off to the position it should be.
How would I position the offline virtual camera ?
If it’s lock to target then it’s super easy: just disable then enable the incoming vcam. It will snap to the right place upon enable.
keep priority # even ?
Yes. If multiple vcams share the highest priority, the most-recently-enabled one will dominate.
still same issue, perhaps i shall take a clip of it ?
That would be helpful Also if you could post images of the vcam inspectors, for both vcams. And your project hierarchy, showing the vcams and the target.
the other vcam has the same excat settings except for Z Damping which 0.2, i simply set the gameobject off and on when the player speeds up or when slow down. in hierarchy the player is at top then cameras
Created a new project just to be sure, same issue… it’s annoying
here the video:
https://sendvid.com/zybzvp7l
this is the script, I’m just changing speed on W input and switch cameras, camera settings are excat same as above just one with Z Damping 0.2 (c_1) and other 1 Z Damping (c_2)
i think the problem has to do with switching cameras while a camera is still returning to normal position.
float speed;
public float norSpeed = 20;
public float fastSpeed = 50;
public GameObject c_1;
public GameObject c_2;
private void FixedUpdate()
{
if (Input.GetKey(KeyCode.W))
{
c_1.SetActive(false);
c_2.SetActive(true);
speed = fastSpeed;
}
else
{
c_1.SetActive(true);
c_2.SetActive(false);
speed = norSpeed;
}
transform.position += transform.forward * speed *Time.deltaTime;
}
Edit: heres another video, this time i use 6 Z Damping for it to be clear, at first blends the 2 positions normally, but if i switch during blend time the camera goes way back
Edit 2: Seems like a way to fix this is to add a tiny blend time like 0.3 or 0.4, however, its still happening but more rare … is there any other way ?
Edit 3: OK, i’ve added a blend check when switching between vcams and it seems to have fixed it fully !
if (Brain.IsBlending)
return;