|
Post by pyxelgamr on Jun 10, 2020 2:24:50 GMT
I use procamera2d's rooms extension in my game and have this teleport script that will move the player to a set position. How ever when I try to snap the camera to the players position it does not work and just scrolls the camera to his position instead which is NOT what I want. I tried adding in CenterOnTargets() and Reset but nothings working. Am I missing a step or a function I need to call? This is what I'm doing when the script is activated :
- player.transform.position = targetPos - ProCamera2D.Instance.MoveCameraInstantlyToPosition(targetPos); - ProCamera2D.Instance.CenterOnTargets(); - ProCamera2D.Instance.Reset();
Any help would be greatly appreciated.
|
|
|
Post by pyxelgamr on Jun 10, 2020 3:04:39 GMT
I feel like an idiot, after posting this I looked back at the help doc for the 100th time and realized it was the rooms transition duration that was messing things up and they don't have a doc for controlling rooms through script, at least none that I could find. So I did some experimentation and came up with a solution that sets the old rooms transition duration to 0 for when I teleport back to the room then restores it to what it was before so it still eases in and out. So to be clear if you use rooms and want to teleport to a different room across the map of your game, -cache the new rooms transition duration variable then set it to 0 so the camera immediately snaps there -then move your player there -finally reset the new rooms settings to what it was before.
I hope this helps someone who is also having this issue. And if there is a help doc with managing these extensions via scripting please tell me where it is lol. Thanks everyone!
|
|
|
Post by Luís Pedro Fonseca on Jun 10, 2020 20:59:42 GMT
pyxelgamr What do you mean by managing the extensions via scripting? They're just normal MonoBehaviours, so you can access them like any other Unity component.
|
|