-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Port 2D Skeleton demo to Godot 4.1 #976
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally on Godot 4.1.2, it works as expected.
I get some warnings when opening the project in the editor though:
WARNING: No Bone2D children of node Chin. Cannot calculate bone length or angle reliably.
Using transform rotation for bone angle
at: calculate_length_and_rotation (scene/2d/skeleton_2d.cpp:451)
WARNING: No Bone2D children of node RightHand. Cannot calculate bone length or angle reliably.
Using transform rotation for bone angle
at: calculate_length_and_rotation (scene/2d/skeleton_2d.cpp:451)
WARNING: No Bone2D children of node LeftHand. Cannot calculate bone length or angle reliably.
Using transform rotation for bone angle
at: calculate_length_and_rotation (scene/2d/skeleton_2d.cpp:451)
WARNING: No Bone2D children of node LeftFoot. Cannot calculate bone length or angle reliably.
Using transform rotation for bone angle
at: calculate_length_and_rotation (scene/2d/skeleton_2d.cpp:451)
WARNING: No Bone2D children of node RightFoot. Cannot calculate bone length or angle reliably.
Using transform rotation for bone angle
at: calculate_length_and_rotation (scene/2d/skeleton_2d.cpp:451)
Could these be resolved without affecting functionality?
I'll have a look at those warnings. I didn't try to fix them yet. |
Fixed those warnings. Seems that you need to manually disable the auto calc option on leaf nodes. Output and Debugger > Errors have no warnings or errors and it still looks right to me: gd-skeleton.mp4 |
Updated the readme to "Renderer: Forward+" even though I didn't make that change because looks like that's now true and other demo updates are making the same change. I guess GLES2 was the default before and the new default is Forward+ so no change in config files is visible? |
GLES3 is the default in 3.x, and Forward+ in 4.x. That said, I suggest changing this demo to use Compatibility if it doesn't need features only available in Forward+. Remember to also do this for the |
Auto changes from opening in v4.1.1.stable.official [bd6af8e0e]
Layout the nodes so you can see how the tree is setup.
Move camera from player to level so we can see the size it's going to use. Change application window to match level dimensions. Set stretch settings to keep our aspect ratio since there's nothing else to display. level.gd no longer does anything useful, so remove it.
Create a tileset from scratch. The old one seemed completely broken, so this seems like an improvement. Now you can jump around the level. Change the mountain positions in background. I don't understand how this is supposed to work, but now they show up in the background of the level.
Fix warning "AnimationTree: 'fall', Value Track: 'Sprite2D/Skeleton2D/Hip:position' must have at least one key to cache for blending."
Fix character stutters when walking up ramps. Instead of entirely unique code for this demo, copy the setup from 2d platformer and strip out some of the fancy features: shooting and audio. Also bring over the CharacterBody2D settings from the 2d platformer. Doesn't feel great (long jumps don't always work, change direction isn't satisfying), but better than before.
Fix "SCRIPT ERROR: Invalid set index 'parameters/state/state' (on base: 'AnimationTree') with value of type 'int'" Change: parameters/state/current -> parameters/state/transition_request parameters/land_hard/active -> parameters/land_hard/request etc true -> AnimationNodeOneShot.ONE_SHOT_REQUEST_FIRE Player now animates in idle, walk, fly, and fall. jump, land, and land_hard fire. land doesn't look very good and jump doesn't look as good as fly, but everything works.
Fix jump arm is stuck pointing out during jump. Fix land glitches and looks like it plays twice. Not necessary for land_hard, but seems like I should setup all the same?
Move camera back to player. Shrink window and setup camera limits so the camera moves around in the world. Copy parallax setup from 2d/platformer -> skeleton and use the same name for the scene. That wasn't enough, so fiddle with parallax until it fills the bg and I can see some movement. There's not much because the camera doesn't have much space to move.
Fix warnings "WARNING: No Bone2D children of node Chin. Cannot calculate bone length or angle reliably. Using transform rotation for bone angle." Those warnings were output for each Bone2D without any child Bone2D: * Chin * LeftFoot * LeftHand * RightFoot * RightHand Disabling the auto calculation seems to have filled in lengths and bone_angles. Presumably these are the transform rotations that it would use anyway. Test * run and jump around the world and animations look correct to me.
Godot 4 new default is Forward+, but we don't seem to require any features from that, so switch to the most compatible choice instead. Test * win64 editor build. run and jump around and it looks the same as before.
Seems fine in GL Compatibility. All three modes are using GL Compatibility now and rebased on master. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested on 4.2.beta3, I don't get any error messages anymore.
Thanks!
References #697.
Major changes:
Screenshot:
Showing character animation (captured before I got parallax background setup):