Devlog: ray casting, face expressions and grabbing (Patreon)
Content
Oct 08
Learning how to cast rays and shapes took quite long, but now the program detects places where Ternera shouldn't stand or which Ternera can climb. I had to fuse the "air" and "hang" states, as the latter could only be entered after detecting a ledge on the former, and that's data I can't send between states. Now the "air" state is gigantic, but I'll try to clean it up as best I can.
Oct 09
The air state is complete and it works perfectly.
Air state
However, there is a bug in the attack state. Whenever the player attacks right after a combo has ended, the animation state machine locks and the character freezes. I'm trying to find what's causing that.
Oct 09 bis
Fixed! The code machine works faster than the animation machine, so it was trying to make it travel faster than it could. I fixed if by asking the code machine not to request an attack until the animation is actually ready for it.
Oct 10
Hot damn, I really did get all the code for the face expressions done in just a few hours. I used exactly the same algorithm I was using in Unity, but it was much easier to program in Godot. I just clone the default mesh, cut the eye triangles out, and replace them with a shifted texture. I even added a debug feature to easily locate the index of the triangles that must be cut out.
Face expressions
Oct 12
I have probably spent over 12 hours programming today, I've had to redo the carrying-object state twice because the first attempt worked fine, but didn't look good enough - it was actually the way I did it on Unity. So now it's better. It's by far the most complex state so far, and I'll have to test it like a madman to make sure no major bugs arise, although you guys will definitely find some when you try it out.
The process itself is rather simple: average the positions and rotations of the hand bones and translate that information to the carried object, then apply an impulse whenever the player throws it. Godot's physics engine takes it from there.
Oct 15
The grab state is complete. I defined a component (yay, design patterns) that teaches a rigid body (like a box) or a character body (like a sheerk) how to get grabbed, dropped or thrown. Once the player signals to pick up an object, it very slightly aligns with the character to improve its grip and the player's collider grows to include the object, preventing them from smashing it against a door frame.
I augmented the grab state to allow targeting enemies, so that stuff can be yeeted at them. Sadly, rotating objects when picking them was too complicated, so I'll have to program the sheerks to turn upside down their own when picked up, because having them shake their little hoofsies in the air is too damn funny.
Grab state