Comments (4)
Can't reproduce in 4.2.2, the print results look like follows, I think it is correct:
1 called
2 called
I remember early 4.2 had similar bug but I fixed it in #85221 so please make sure your version again.
from godot.
Sorry, I somehow missed that it works correctly for the 'deferred' call method mode. It only breaks for the 'immediate' mode.
Godot v4.2.2.stable.mono - Ubuntu 22.04.4 LTS 22.04 - X11 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1050 Ti (nvidia; 535.171.04) - Intel(R) Core(TM) i5-6600 CPU @ 3.30GHz (4 Threads)
from godot.
I could confirm this, but I think this is a fairly rare use case and extremely near by specification changing instead of bug, so I don't know if we can support this. Also I remember making some fixes to the process immediately after playback in AnimationPlayer, so it might be no longer be needed the advance(0) hack after 4.2. Please check if you realy need to do that.
The reason for this issue is that since 4.2, it keeps a track cache for all animations, so to reproduce the past behavior, just discard the cached method once, but this may corrupt the crossfade.
I will look into whether play() can destroy the in-process track cache if there is no fade there, but the workaround available to you now is to explicitly destroy the cache by firing stop() before the animation changes, as shown in the code below.
func call_track() -> void:
print("1 called")
$AnimationPlayer.stop(false)
$AnimationPlayer.play("Anim2")
$AnimationPlayer.advance(0)
BTW, it is not recommended to do this in immediate mode in the first place. The reason is that if there are other keys in the same position as the method track, they may or may not be processed, depending on the order in which they are iterated within the method track core, which is out of the user's control.
from godot.
The real project is more complicated, the called method does a lot more and the change to a new animation is of course conditional, depending on intersection tests which must be run during physics frames.
Perhaps I do not understand immediate mode correctly but I use it with process mode physics to make sure that everything is happening during physics frames when needed.
This is a port of a Godot 3.5 2D pixel art project. I cannot recall the details but I had to use this technique to avoid incorrectly failing intersection tests or a wrong sprite frame being shown or both.
I do not think that this is a rare use case but perhaps it is.
I, too, found the workaround with calling stop() and it's good enough.
Nonetheless it is unfortunate, that the user needs to know about internals when deciding to use deferred or immediate mode.
That other keys may or may not be processed should seldom be a problem as you want immediate change to a new animation anyways.
I understand that it may be difficult to make this work with the new animation system so if it cannot be done, it cannot be done.
But at least it should be mentioned in the documentation that advance(0) is not safe in conjunction with immediate mode and that you manually must destroy the cache. And while we are at it perhaps an explanation for the deferred mode if "after events are processed" means during physics frames if process mode is physics.
Thanks for your time
from godot.
Related Issues (20)
- Clicking on the color picker crashes the PC (Fedora-Silverblue 40) HOT 2
- Editor shows non-existent folders based on dependencies
- With Wayland enabled Godot windows often show the wrong icon in Alt+Tab switcher in GNOME
- Physically incorrect behavior of RigidBody3D HOT 1
- Web export doesn't work correctly with binary GDScript HOT 1
- Grass performs poorly HOT 2
- Noticeable freeze after saving a scene
- Display DPI scaling (Microsoft Windows Setting) leads to incorrect canvas size in web export with ALL Canvas Resize Policy
- Restarting game freezes entire system HOT 2
- GltfDocument Memory Leak issue HOT 2
- Array.remove( int position ) accepts String as an argument instead of throwing error
- Incorrect lerp usage with deltatime for camera smoothing (and probably other things too) HOT 3
- Incorrect flat shading HOT 4
- Bug when downloading export templates and re-open the template manager HOT 1
- Godot editor crashes under Linux with Wine HOT 1
- `Vector`'s constructor fails to create a reference to the other `Vector` when the other thread writes to that object HOT 9
- RigidBody3D wrong physics behavior HOT 1
- Wrong cursor detection when changing buttons default cursor shape while using a stretch mode other then disabled
- GDExtension: pointer parameters of type `real` are declared as `float*` in JSON HOT 3
- AnimationTree StateMachine transition animation reset behaves weird depending on blend position HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from godot.