2D blend space node, animation graph debugging tools #78
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a couple of things:
A 2D blend space node in the style of Godot's AnimationNodeBlendSpace2D. Inputs to this node are mapped to a 2D plane and triangulated. At runtime, a
Vec2
parameter is passed in, and the output pose is the linear combination of the poses mapped to the vertices of the triangle that the input vector is contained in. If the input vector is outside all triangles, it is projected to the closest one.You may note that there is no such thing as a "linear combination of quaternions". Instead we treat them as a Vec4, compute the linear combination of the vectors and re-normalize the quaternions. This usually works reasonably well (see Gramkow 2001), is independent of the order of the quaternions and is reasonably fast. The main issue I've found with this is that, while quaternions
q
and-q
may represent the same rotation, when converted to a vector they are quite different and mixing in some "negated" quaternions can result in nonsensical output animations. I'll need to do more research on if/how we should solve this.Some debugging tools for animation graphs in the editor. This wasn't really in the original plan for the PR, but I found myself needing better tools to debug issues with the blend space node. In particular, you can now:
Scene and pose previews can now be rotated and zoomed in/out with the mouse.