Hi
When i switch player
the camera which follows the old player, immediately go to the new player position. skipping the following process.
how should i prevent such behavior,
thx.
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
In ActionPlayerSwitch, comment out line 292:
Does that prevent the snapping?
Yes it does, thank you!
with the new update
even comment out line 209
KickStarter.mainCamera.attachedCamera.MoveCameraInstant ()
or turn alwayssnapcamera off
will snap the camera
It is cause by line 140
KickStarter.mainCamera.SetGameCamera (oldCamera,0f,MoveMethod.Linear,null,false,false)
adding the last argument to false will stop the snapping
Apologies. Commenting out line 209 should not be necessary so long as "Snap camera if shared?" is unchecked, but you're quite right about line 140. I'll address this in the next update.
I am sorry after the new patch, i am not able to turn snapping off again.
Either by using actionlist
or by code:
ActionPlayerSwitch playerSwitch = ScriptableObject.CreateInstance();
playerSwitch.playerID = targetId;
playerSwitch.takeOldPlayerPosition = true;
playerSwitch.alwaysSnapCamera = false;
playerSwitch.Run();
it still snapped when I change character
Can you describe your situation in more detail?
You're switching Players in the same position - so the camera shouldn't change. When you talk about the camera's "following process", are you talking about the camera moving due to being mid-transition at the time of the player-switch, or should the new Player's camera be different from the old Player?
If you're using the latest release, try commenting out line 140 in ActionPlayerSwitch:
Does that resolve it?
Ignore my suggestion above: if you're referring to the camera being in mid-transition at the time of the switch, that's not enough to resolve it.
I have recreated this behaviour, though, and will have it fixed in the next release. To confirm: is this the situation you're encountering?
Sorry for late reply
Line 140 in ActionPlayerSwitch is
KickStarter.mainCamera.SetGameCamera (oldCamera);
I am not able to find "oldCamera.MoveCameraInstant ();"
My version is 1.72.4
Detail of my suitation:
I am talking about camera movement due to the following behavior(following player) of it, I intended to switch player while walking the player, which causes the camera to follow, i am then switch it to another player, expecting the camera to continue its following behavior as the new player replaces old one in the middle of a walk.
To clarify: the MainCamera isn't in the middle of a transition between two GameCameras? It's instead that a single GameCamera is moving because its Target is set to the Player?
The "MoveCameraInstant" line should be right above the "SetGameCamera" line.
If you switch back to the first player, and then again to the second, does the issue still occur - or is it only the first time the switch occurs?
Be sure to attach a Constant ID component to any GameCamera that can be active when such a switch occurs.
I finally figured out, it is due to the corruption of AC package file,
It was downloaded and keep importing the wrong version even I deleted the entire asset and reimport ac again.
I somehow deleted the ac package file on appdata/roaming/unity
redownloaded it at unity package manager
which solved the problem.
Just to clarify, it is not in the middle of a transition between two GameCameras
It's instead that a single GameCamera is moving because its Target is set to the Player
Which problem? The original issue of the thread, or not being able to find the correct line?
If the main issue is still occuring, please see my question above about repeated switching.
finding the correct line and solved the original issue of this thread
It does appear at repeated switching orginally
My apologies, but though that has fixed the issue on your end, I don't have enough detail about your specific situation in order to make such a change officially.
Does the active camera at the time have a Constant ID component? If you have the time, please insert the following above the line we discussed and let me know the Console message it displays at the time of the switch (both first and repeated):
It has a constant ID
New camera: NavCam 1 (AC.GameCamera2D), ID: 0, Old camera: NavCam 1 (AC.GameCamera2D), ID: 44016
first and repeated action print the same
Thanks for the details.
To be clear: you've placed this inside the comparison check for KickStarter.mainCamera.attachedCamera and oldCamera? If they're the same (which the log suggests), the code shouldn't be run.
Do you only have the one camera named NavCam1 in the scene?