-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Camera2D limits doesn't work well if limit_smoothed is enabled #56336
Camera2D limits doesn't work well if limit_smoothed is enabled #56336
Comments
I already seen the previous bug report but I still have this problem , although I used |
Unfortunately some of the artifacts have expired since then but if you look on here you can see some of the commits since 3.3.3. Interestingly #46717 was present in 3.3.3 (which is probably the biggest change), so you most likely looking at a commit after March 8th, and to July 27th which is the date of 3.4 beta 2 which shows the new behaviour in my tests. https://github.com/godotengine/godot/commits/3.x/scene/2d/camera_2d.cpp EditHave bisected it and this seems to be the commit causing the change in behaviour: |
Unfortunately I'm away for holidays so I don't have access to my Godot stuff until next week. The first behavior you're seeing is by design based on the changes in 3.4 betas and eventually 3.4.0+. What is interesting to me is that the reset/force is not working as expected — invoking the reset should be calling literally the identical code that my change skips (when smoothing is enabled). It's possible the timing is off (i.e., the reset call is too early), but until I can run the code I can't say for sure. As for the second issue, I've never seen anything like that in my platformer despite using limits and smoothing in tandem. Unfortunately, like the other issue, I'll have to run the repro project before I can figure out what's going on there and if it's related to my change. I'll give these issues a look next week when I'm back at my desk if no one else is able to before then. |
I looked into this a bit. It looks like some behavior has changed since I tested and implemented the original PR #49409 back in June. Specifically, PR #50935 changed how I tested this by executing Granted, this is a really ugly workaround. Unfortunately I'm not sure of the rationale for the above-mentioned PR (#50935); maybe @Vitika9 can provide some insight as to exactly what changed in this PR and perhaps what the best resolution is now. |
Relevant issue: #50807. CC @Razoric480 |
I have applied |
As calling issue.mp4May be we need to call |
So it looks like the prescription (for now at least) would be to call them in a specific order (first reset, then force update), rather than calling one or the other or force → reset. Might be worth considering whether we should A) take the suggestion you mentioned (update then fix camera pos then update again), B) document this specific way of doing it, or C) have a new method specifically for forcing a camera into its limits immediately with no smoothing... or, D) another suggestion I haven't thought of. |
It implies a deeper symptom, though I'm not really sure how to fix it beyond the ways already outlined. |
Regardless of what is done further, for now this should be documented. |
Is this actually a Godot bug or is it just an unexpected change in behaviour in your project following a bug fix? It appears to me that the camera is now moving (smoothly) within the limits (and default drag margins) specified, whereas before it wasn't (a bug). |
Related issue: #56913. |
Still in version 3.4.4 stable the problem persists. Testing I have noticed that the only responsible is to checking 2022-06-15-11-24-08.mp4 |
I have tried version 3.5.rc7 and the problem persists. |
What problem exactly persists? |
@madmiraal when smooth is activated to a 2d camera, at the start of the scene the camera2d moves to its starting point (the player's position) this problem was not present in godot 3.3 but with the change to godot 3.4.1 this happens: smooth.mp4when that initial camera movement should not happen. To avoid it, I have to deactivate the smooth and the camera will position itself on the player without any problem... smooth_disabled.mp4 |
Just as an aside, I don't know whether it's related, I haven't really been following this topic, but just to mention that in this functionality:
|
@dannygaray60 This is the expected behaviour. It was a bug that the camera did not scroll smoothly to its new position. If you want the camera to immediately snap to the position and not move there smoothly, you need to call Note: #63330 captures some of the remaining bugs with |
I have done some tests. If the camera is positioned as the child of the player it does not give problems with However there are games that to position the camera, make use of Applying But, I am not sure if that So I have nothing more to say 😅 PS: Maybe it should be warned about this problem with smooth in the documentation just in case someone else uses global_position to follow the player like me. |
@dannygaray60 Yes, this is the expected behaviour. If you change the camera position and you don't want it to scroll to the new position, then you call Note: If, as you suggest, you make the You are right in that this fix should be included in the release notes; since you're probably not the only one that's used to the previous broken behaviour. |
We can't rename methods anymore throughout 4.x, now that 4.0 is in release candidate stage. |
Godot version
3.4.2 stable
System information
Windows 10, GLES2, Intel HD Graphics 610
Issue description
Since godot version 3.4.1 the camera limits stop working properly if
limit_smoothed
is enabled, while in previous versions it never gave problems. When starting the scene, you notice a movement of the camera as if it was being moved:0.Bug.Camera.Limit.and.smoth.limit_Trim.mp4
And sometimes when setting certain limits, the camera moves slightly.
In 3.3.3 works fine:
1.good.with.3.3.3.stable.mp4
But this happens with 3.4.1 and 3.4.2
2.bad.with.3.4.2.stable.mp4
Steps to reproduce
Enable
limit_smoothed
andsmoothing_enabled
totrue
on Camera2D.Minimal reproduction project
TestCamera2DLimits.zip
The text was updated successfully, but these errors were encountered: