IK-Driven Procedural Spider Locomotion In Godot 4.5
Game Developer dacaffee shared some details about their approach.
Game Developer known on Reddit as dacaffee revealed that it took them around six hours to reach this stage, and no, they weren't using Godot 4.6, which is set to bring back Inverse Kinematics.
They shared some insights into their development process:
"The way I structured it is that I don't move the bones directly. I have Marker3D nodes that act as IK targets. The SkeletonIK3D only tries to reach those targets, and my script only cares about moving those markers. I used a tool script to test the free movement in the editor to ensure it was working properly before playing.
Afterwards, I added the step logic: each leg has a raycast (step sensor), and I calculate a "future position" based on the raycast collision point plus the player's velocity. This new point is the step destination. If the distance between this destination and the current IK target (the foot) is greater than a threshold, I trigger a step function that moves the IK target to the destination in a nice arc.
Then I grouped legs into diagonal pairs so only one group can move at a time to keep balance. I then take the average position of all 4 legs to set the chassis height. For rotation, I calculate the normal vector of the terrain based on the IK targets' position and align the body's basis to that normal. Oh, and I also added a little hovering effect by using a sine wave to slightly vary the height over time."
For more details, check out the original Reddit post. In case you missed it, Godot Engine 4.6 has just entered beta, and users are strongly encouraged to try it out and participate in bug-hunting sprints. You can find additional information here.
Also, Godot 4.6 will reintroduce Inverse Kinematics, now with significant improvements. Read the newest blog post by clicking this link.
Don't forget to subscribe to our Newsletter and join our 80 Level Talent platform, follow us on Twitter, LinkedIn, Telegram, and Instagram, where we share breakdowns, the latest news, awesome artworks, and more.