|
Post by robautomatic on Apr 15, 2017 21:08:38 GMT
Hey Luis, glad you opened up a direct forum for this! User since the early days. I have a question: I'd like to use ApplyInfluence() as a way of allowing the player to slightly pan the camera around with a right analog stick, for example. Which works fine as-is, but when moving my player character (which uses Rigidbody2D, and naturally, moves on FixedUpdate()) and applying the influence at the same time, I'll get stuttering. Swapping between ProCamera2D's Fixed and Late Update settings will give me either-or (stuttering while moving character on Late, and stuttering influence on Fixed), of course. I know of Manual Update but I'm not exactly sure how I should utilize that to "combine" the two update types. Is there any way around this or would the fix be the ultimate "move player character via transform and not physics", because that would suck, haha. Thanks in advance!!
|
|
|
Post by robautomatic on Apr 16, 2017 0:32:56 GMT
I actually figured out a decent way to correct this. I'm just updating the UpdateType whenever I use it and it works well!
if (_moveCameraX < 0) { _maincamera.UpdateType = UpdateType.LateUpdate; _maincamera.ApplyInfluence(-_viewDistanceX * -_moveCameraX); }else _maincamera.UpdateType = UpdateType.FixedUpdate;
|
|
|
Post by Luís Pedro Fonseca on Apr 16, 2017 22:04:50 GMT
Hi robautomatic, great to see an old time user here! The reason for this to happen is that the "influence" is calculated during whatever UpdateType you choose for the camera (Fixed or Late). If you choose LateUpdate and then call the "ApplyInfluence" method on a FixedUpdate loop (or vice-versa), you'll get stuttering because the "influence" is cleared on every call. So on your case, if you're using a FixedUpdate for the camera you should also call the "ApplyInfluence" method on a FixedUpdate loop.
|
|