I made a playground for my duck! I've been working on physics interactions and couldn't help myself. Unfortunately development is now on pause as I’m too distracted riding the slide😆
A few details about the changes ⬇️
#gamedev
#screenshotsaturday
Last weekend I posted a video of the duck I’m making with procedural animation, and the response was really encouraging! Some of you were asking how it’s made, so I thought I’d make a little breakdown of the setup! 🧵
#gamedev
#unity3d
#ducks
Duck model update!
I thought I'd simply add moving wings.. how hard could it be? 💀 Three weeks later I think it's finally working and I'm so happy. I also changed the proportions a bit, and added eyelids and tail wiggle!
#screenshotsaturday
#gamedev
#indiedev
I'm making my ducks head act more ducky, along with some targeting and avoidance behaviours. I'm so pleased how much people love this little one and thank you to everyone who gave feedback these past weeks! 💚
#screenshotsaturday
#gamedev
#madewithunity
Once again I got side tracked playing my own game. This time just triggering a hilarious physics bug in the grab interaction system I'm (supposed to be) working on.
#indiedev
#gamedev
I added some motion transfer between the feet and moving objects. So things can get pushed around by the feet and the feet will stay in place. I can also tag surfaces like the merry-go-round where the body should try to copy the surface’s motion. Really happy with this!
I’ve started a pass on the head movement by making the head a separate physics object from the body. I like how it reacts more to collisions, and adds some boing when landing. Somehow though I feel like it’s less expressive than before, but it’s a start!
Ducks always look so squishy to me and I wanted mine to reflect that. So the rig doesn’t follow proper anatomy and many bones are separated so they can move independently. Each leg is just the foot and a single bone that morphs the body to imply a leg.
If you made it this far thank you so much for reading! And if you learned something new from this or maybe got inspired to take a quack🦆at some procedural movement, I’d love to hear!
You can improve it by limiting the number of feet that are allowed to move at once, and step the foot that is farthest from its target. At this point you can move the body with scripts or whatever and it looks pretty good! I just have a few more details for some extra realism.
Step 3) Find each foot’s “preferred” pose relative to the body, usually using a raycast down to the ground from some point on the body. When the distance or angle is big enough between the foot and its preferred pose, tell it to step.
It really puts the other systems to the test, and I'm pretty pleased how stable it actually is haha. It's fun watching it in slow motion, everything trying to figure out what to do.
#indiedev
#gamedev
Finally, I change the speed of the steps based on the body’s linear or angular speed. Also I don’t just raycast from the body’s current pose, but use its velocity to look ahead and cast from where it will be in one step’s worth of time.
Step 2) Make a script that can perform a step given a target position and rotation. It should move the foot on a curve from its current pose to the new pose.
And I think that covers the majority of the leg setup at the moment! I’m not sure if that made any sense at all, but I hope the gifs were entertaining at least 😅 I have a lot more planned, and I'm looking forward to sharing as I go!
Back to the feet, I mentioned before that they will tuck it their target is too far away. So I added a rule that a tucked foot will be told to step as soon as a new target pose is found, regardless of the other leg. This allows both legs to extend when landing from a fall.
I can’t go over the whole rig, but I'll point out two important constraints I made. One adds rotation to the body based on the separation of the feet for some easy wiggle action. The other bends the toes at a secondary joint when the first has too extreme of an angle.
Step 1) Rig the legs with IK so the feet stay still when the body moves. I use Unity’s Animation Rigging package for rig constraints. It has some standard constraints that will be enough for most situations, but you can make custom ones if needed.
To keep the body upright, I have a configurable joint with a slerp drive and configured-in-worldspace ticked. Then I can just set the joint's Target Rotation on the joint in a script to make it turn with physics.
My duck’s feet have a few other features. I can change the speed of the step. Also the foot is prevented from going too far from the body. And when not stepping, if the body gets too far away, the foot clears its target and tucks in at max speed.
The duck’s body is a physics object and I move it only by applying forces. This allows it to push and be pushed by other physics objects. Joystick input applies horizontal forces, and a vertical force gets applied to keep it hovering above the ground.
The height it’s trying to hover at is based on the successful raycasts from the leg controller, and only applies if at least one foot is grounded. That way it can fall off ledges or trip if it can’t find footing.
Disclaimer: I’m definitely not an expert on this stuff and there’s a ton of resources already about procedural animation, so I’m going to keep this pretty high level. Okay let’s go! I've grouped the setup into 3 main steps, with some smaller details between.
Exploring an old hard drive, found copies of these collision tutorial files from
@metanetsoftware
I downloaded in 2008. Thanks Metanet for making these available ❤️ I basically learned programming by studying these!
@hony_beea
Oh good question! I use the normal from the raycast hit as the up. Then I project the body's normal on the surface plane to get the forward. So:
targetRotation = Quaternion.LookRotation ( Vector3.ProjectOnPlane( body.forward, hit.normal ), hit.normal );
Picked up this old project again. It's slot cars meets F-Zero, and I'm really pleased with how it's turning out! (this time 😅)
#gamedev
#screenshotsaturday
#unity3d
@Tumerboy
Thank you! I love my sweety little duck. Hot take though, I think Goose it totally wholesome, it just shows affection by being a little rascal 🥺
I made a skybox shader with day/night cycle, fake sunlight scattering in fog and cloud layer, and twinkling stars. It took a while.. was it worth it?
#screenshotsaturday
#gamedev
#madewithunity
@HagerConnor
Thank you! It's like, the movement is created in the fly by a bunch of scripted rules and physics rather than premade animations. I posted a little breakdown of the leg movement if you're interested!
Last weekend I posted a video of the duck I’m making with procedural animation, and the response was really encouraging! Some of you were asking how it’s made, so I thought I’d make a little breakdown of the setup! 🧵
#gamedev
#unity3d
#ducks
Going through hoops impresses your babies. More straight and centered gets more points! (and more particles ;) I will probably add a speed bonus as well, later..
#gamedev
#screenshotsaturday
#madewithunity
Adding "stupid" to the end is just needless complexity. I think having only one S in the acronym and still pronouncing it "kiss" is actually a good example of keeping it simple..
Hello! I'm a game developer and today I turned 45. Some say this is older than the allowed max of 25. Still making games. Still excited about the future. (self-indulgent thready-thread)