 Why is this show offline? Oh, there it goes. Okay. There we are. So So I want to correct something I said last time I because I didn't I just you know, I got that video the Wolfire animation video When I didn't actually read it and it had been a while since I looked at so that was actually somebody comment about this That's not what they're doing in Overgrowth, that's what they did in the previous game Luger or two And then I'm not even sure he did that for the shipping game. That was his it said it was for the demo of that So, uh, whoever it was you're correct. That's not what they're doing in overgrowth I did talk about the fact that there's the keyframe based stuff But I was thinking it was an evolution of this and it's not really it was sort of like Start over and figure out a different way to do was kind of similar thing The thing is since most of what I've been doing here has been working on the foot placement for the ik that's all Kind of independent of how the rest of the procedural system works and so and that's sort of what I think about mostly And but it's true that the rest of the procedural system is very different so um And I talked about it at the end of last time that um, we're Drawing we're not drawing the legs I was figuring I would get all the feet working and then go to do the legs But it might be the case that it's better to show the legs So you guys know where it's going because I did get somebody who was like, you know Oh, you could do ik and it's like this is for doing ik. I just haven't gotten to the ik part of it yet um There's two things I'd like to clean up one is that the left foot is called right and that the right foot is called left I should probably fix that. I don't know why those coordinate systems came up backwards Unless it's just that I I guess it was because Yeah, I don't remember how that happened um The other thing is I'm looking at this as if this was a torso and it's actually going all the way up to the top of the head So maybe we need to make the guy bigger So that that because I've kind of spaced things out for that to make sense So you look how tall this guy is he should be his head should be up on that Third row a fourth row rather rather than say this is three high over here, right? That's three high So his head sticks up into the fourth row Whereas minecraft scale third three high And I think I have this right the actual If you don't think of that as torso if you think of the top of that as the top of the head Then it does in fact stick halfway up into the third row But if you think it was a torso, there would be a head sticking up into the fourth row So I should probably make it be that tall Because like as I said before we don't need to work at minecraft scale um And so then the other thing is this whole Yeah, the dropping foot placement. I think when that happens the whole torso needs to come down It's a force that needs to tilt some but I think it also needs to come down. This is a bit different from the Wolfire thing because the world is so discontinuous. There are no slopes. Well, there are slopes, but they're not in the physics yet So they don't do anything But everything has these blocked discontinuities and so the foot placement is very Uh Very more important like on On smoothly changing slope terrain. It's matters because if you don't account for the slopes, it's totally wrong But you can kind of use a local approximation of the current ground Uh I don't know if that's what he did or if he actually I guess he does detect real foot placements in the long run Or at least in the new stuff because it can like run on walls and stuff using the icase So it's it's a much more precise iK Another thing is that I did this whole thing of Putting a little box around the foot to decide where the foot should go Which results in the foot placement like that where it Is just touching the back of the heel and it can be the just touching the front of the toe like that um, and that's actually not Very good. I mean you can do that one running you can land on your toes and use your toes But you can't stand still on that you have to Put your while you can but it's really awkward you really prefer to put your foot your weight on your foot and I'm thinking if I just I mean on your um Not your ankle on the Whatever you call it the ball of your foot the The part that's right below the leg that's just better for balance. And so I'm thinking I should probably I actually just change it to point sample whether you can stand in a spot and make the Point be in that position and that would probably be better since it's allowed to shift the positioning of it It would cause the the feet to shift better. So I should probably do that and And then that opens up the possibility of of doing that search much more efficiently currently I just do this big search over possible positions Without regards to where the blocks actually land, but I only actually need to sample a little region of four of two by two When the horizontal plane And can compute Directly from that where the foot should go rather than try to sample all these different positions and see which one is closest to the goal So that's something I can do But like I said, I think the first thing I'll do is I'll go ahead and add the legs so that people have some kind of idea of Where it's heading And so they can start to see that the leg is stretching and stuff Yes, and obviously you don't shuffle your feet while standing still that's just like Uh, just a whole I have to add a whole state machine kind of thing that stops the animation when you're stopped And and do something to slow down the animation speed. I I want to add a walking versus running and have those use different um Feet timing so there's different gates And then it solves where to place the feet based on the gate So what are all those things I just said I treat foot as point sampling Better foot placement Better foot search without searching which foot placement search um Still walking and running states Gates What else did I say? Um, there was definitely at least one or two more Only 10 watchers 10 viewers. Wow crazy low. Um Gosh, what did I say? Um, oh guys tilt torso All right and 10, um above torso increased player size to match Uh, a thing I didn't talk about is that there's um Uh, this thing that I keep getting broken by which is that the position of objects is their eye position Instead of their feet position and I always use feet position And so when it's not feet position, I keep having bugs because I forget that so move position of objects to be on ground feet Um, meaning the coordinate that's stored for the object the origin of the object in its local space Uh, should be at the feet um When one foot is much lower a b many gates many stances Yeah a gate it's rather not okay. It's many torso Adjustable Or so position on my three Um This not all these are to-dos right away, but as long as I'm thinking about this I might as well stick in all the related things I can think of Um, was there anything else? I think there might have been one more You said rename left and right in the code. That's right. They were I had said there were two um Bad things in the code What I was and I only explained the first one which is the left and right foot And then the second was this problem of the origin of the object not being in the right place So these two are um just uh Um Miss designs in the code basically and so I'd like to fix them before moving on to other stuff And then I think I'll do the IK um Just because Uh So you guys can see what's going on the actual hard part of that I mean it will be tedious to do the math But I can copy that from somewhere the hard part is actually going to figure out how to render the legs. Um But we'll come back to that All right, so let's do The left foot right foot naming So we basically want to rename all the lefts and the rights in here. I believe Um Okay, let's am I correct about that. So which one is green green is the right foot and we're seeing it on the left, right? Oh god, right. I said word right Green is on the left. Okay, and here's green And it thinks it's on the right. So we go through all this Or all this stuff is computed Sure here And here's what we do we rename left to x y z z y We rename right to left And we rename x y z z y to right Now the left foot is green We'll try running it So the thing I just did is of course your standard how to swap two variables. You need a temp and you Copy one of them into the temp and then do the other thing. And so I just did that with renames x y z z y was my temp So yeah, this looks like I did not break anything there. So that's done It seems to me you should fix the height skeleton overall first. Um, I'm not sure if you mean that or you mean Head above torso and please play our sides to match or you mean both of those sort of which is probably valid As long as I'm messing with the one I might as well mess with the other Although of course, you should also always do each thing one at a time not mess with two things at the same time And then not know which thing you broke So Uh, so the first thing let's do is the first half of that Move the position to be on the ground. So The first part of that Is to just change the size for type so that the bottom is zero below And the top is two point five above And then we'll do that for each of these as well Zero although I have no way to create them anymore. So I won't be able to test that stuff Um, I don't really need f's I don't remember if it's legal to have them have f's without a dot or not. So I should be the same as that Okay, so now their heights are adjusted And it's possible That everything just works automatically except that the eye position will be at the wrong height now Because everything was being cued off of that all the physics and everything was computed directly from that box that's that was ace intentionally allowed it to be asymmetric So, yeah, I think that Works I just need to fix the eye height And I should type definitely type properties So we have should it always be symmetric on x and y? I think it should size y size the height And it should always be zero For the thing so we can shrink this down to only have three things and then we'll have a fourth property float i And the offset will actually have that be an offset from the top instead of the bottom for various reasons And then we have type properties type just leave that positive I think that was what the old state was um, I don't need the eye offset for Anything other than the player, but you know, maybe you make a game where you can possess creatures or something So we'll just have that information available for everything. Well, let's just leave it as zero to indicate. I haven't Done it zero point three zero zero point three zero So none at the beginning and the critter is the same as the player for now This in the header file Does that seem reasonable? Okay, and then we have to fix everywhere that used the old thing Properties for type is going to be really tedious to say Wait about the data. I don't know. I'll make it that short. All right, so Let's go through these one by one type prop Oh type Oh, I have to have to fix that in the header too Let's uh, let's leave these pre divided after all In fact, if we never rotate when we sample these they're always going to be identical too Let's not let's not pick that in But it doesn't mean it will have to some of this code will be wrong Um, so these are half sizes now and I don't need this declaration in both places That needs to be negated because we said it was us. It was the min That one needs to be negated as well There's always zero and this What is plus? This one is plus This one Which is really just height Okay, let's find the next one Um type properties type Yeah, here I did what I ought to be doing most of the time Wait, is this going to be oh, it's for the rendering so it passes in currently so passes in a centered position Um So we can actually just pass in Well, I won't change it. I don't want to break things by changing it So two times p arrow half size x Y already centered smooth z for rendering takes college position and that Then adds half the size No adds That's to find the center. Yeah, so it is still just p arrow height over two Now we probably should change that to pass in the foot position, but I'll do that as a separate step That is the top Is that supposed to be the eye height? No Because that's somewhere else It's just passing in the top for some reason Even though it's redundant to this Oh, no, it's passing in the bottom. I misread that code That's the bottom that's the bottom this is the that's the part where the code is cleaner if it's the bottom Uh, this can no longer pass inside to type Um, let's just go ahead and pass in the properties I think I'm thinking about is that there's multiple functions like this and if they all take this properties It's going to be a bunch of things to change Oh, we gotta change They all take this called a tp not p. Let's do this for now Rather than try to propagate this into all this code. We'll just Compute it to get the old thing from the new thing. Oops. We'll have to do that in the other functions, which I Might be above or below. Don't remember I guess it's Okay, that should be all of them What's the bug beyond through this has to pass to be on through. We don't actually need it Size in this one different from declaration Walker ball Pawsville dt type properties Pawsville. What happened to dt? Deleted accidentally Besides type All the uses of size are here Why do we I think this is old code? Oh, I know what this is for. No, okay It's still kind of a hack, but Not sure how to do it better That's the ground position. I guess we can just pass in the type instead of the type properties Okay See if that still works. I'm of course not testing the ai's and all that other stuff Is that code still in there? They are not pathfinding to me There they go. I was standing in a bad spot. So it's good feet future expansion All right And then we want to change the player height I have the torso Let's not be taller. So let's go into It's in main render player Let's call this render biped Although it's all still using global variables. So we can't actually hook it up to the To the ai's yet Let's take a type properties Then do we use the size anywhere else? Nope So we can take out the size computation Move it up here and then this minus 1.4 What's that for? Oh, I didn't have it hooked up the camera height thing yet. Did I break that? There's tp in here somewhere Okay Um, so yeah the camera height is still down at the feet so third person Cam lock where does cam lock up? Ah, here it is And in first person it wants to actually use plus player ID height minus type Oops, and it's about player Surprised that already completed anyway And that shouldn't be hard to get to the player for that same reason. I was just talking about Um, so yeah, I moved the third person camera to not be dependent on eye height just because hey It's a third person camera. It could just be something I guess it could be still based on the height of the object for a second But then let's just add a little bit and move it above the player instead of alongside the player legal for struct Point third person Stop drawing that stop drawing that crap on the screen there You got a lot of work to do here. I guess I don't want the camera that heights too hard to see the feet I know I've lost too much speed Oh, and I missed the jump shoot And if you're in mid air, you can't lower your torso. So I'll have to Do that I don't think there's really mid-air logic currently Um, where was that list? It's in main Can't Lower torso when in mid air Okay, so Move the position of objects to be on ground feet Head above to or so increase player size to match. Okay, so Um, c Probably should go in object.c And so let's make the player taller See what that does. Yeah, I need to move the camera background I was wrong So now there's room that now that includes the the head I'm not actually gonna make it separate yet. We'll come back to that Oh, no, I can't fit under there anymore. Oh, it's kind of nice the the tilt running out when you run into the thing all right Oh, and I still have to do tilting around corners Sideways tilting around corners sideways tilt around corners Okay, so I'm not actually gonna do a head. I'm just gonna Do that so Um, I get likes to feet So When we get to here we have the feet Where do we draw the body? That's right here. Let's go ahead and move drawing the body down here And now we can start to see that these are all part of a pattern and we can modularize it Oh, that's my microphone right in front of me Um, so what do we want to do? We need to know where the bottom of the torso is We need to know where the feet are and we need to draw a connection so Draw a cylinder from the two And it's going to draw from The bottom of the thing is determined by that. So we need um Which is ob space to World space So we need to make a new version of ob space to world space Output input x And there's a way to do this directly where you have Uh A big matrix But I don't think I put that in my vector library Rotational axis rotation or a veck, but yeah, we don't have a We don't have one for the whole thing So there's no reason to directly construct the matrix. It's not going to be any more efficient. I don't think Uh, then just applying the three rotations in sequence But we do have these So I don't need to write them out the way I have in those code because I wrote this code before I added the vector library So I can do that here And what's the ordering? z then x then y z Then x and y okay, so One two Actually, does this library do the right thing? Rotate that three veck mall all split three three veck mall Yes, it does the right thing So you can pass in the same vector and it avoids Screwing things up. So I don't need any attempts So we just say input Z That's a lot easier than I expected it to be forgot. I had added the vector library Yes, I use a compatibility context so I can still do this stuff because I think it's dumb that they got rid of the matrix stuff Because you still need it You have to add a separate library to do it And for those who are wondering about this particular ordering of the things Um, I use y as the forward direction rather than x for some reason um I think because if you use a right-handed coordinate system z is up, of course and Uh, if you use y forward Can't get a good angle for you to see like that Uh y forward that says y x y z Uh if y is forward then x points to the right so the positive direction makes sense if you point along x Then y points to the left Uh positive y points to the left, which I think is too confusing. So I use looking down y z is up And so the rotation order because these are order angle rotations rotation order of z x y is um yaw pitch bank Which is the order that you want you want your yaw to always be measured in world space. So as you yaw You know as you turn your orientation that should just always be in the plane And then bank should always be last because you're pivoting Around the camera Regardless of how you're oriented. You're always pivoting around the camera. So that's I always use that convention for order angles um And we will maybe have free form coordinates for The knee positions. I don't remember how that math works. We'll we'll see in a second So let's put that in the header Let's go back to main here. Okay, so we want to know um Let's say the half of the size so What do you call the where the joint of the leg and the and the torso is naming So left leg top do we have tp in this? Yep, okay tp arrow Size x y equals zero. So this is in object space. I'm trying to do this um Where did I decide how tall the torso is? That needs to be in the type properties Well, it needs to be in the biped properties, which probably shouldn't really be in type properties But right we actually probably want I was probably wrong to put this into the size thing because we probably want a thing That's limited for just creature types and we don't bother having it for everything else. So we have an iz offset. We have a torso the offset torso feet Torses the offset. Okay, so we're going to object. Well, let's check where it is in the code. It's right here 1.4 We subtract off 1.4 of the height so um All right, that's not all completing anymore. Did I screw something up? I don't think so the offset Offset will mean it's an offset from the top height will mean it's a height from the bottom It's the base Completing except it was all completing with a misspelled thing. So left leg top z equals tp torso base All right, then we rotate it Not what I called it rotate vector top But we actually want to rotate that around the center So we need to measure these coordinates relative to the center so Center is pause dot z But that's in world space pause dot z is in world space, right? Yeah So we just want the offset So that needs to be relative to the center Should have been the center z height not center of the offset meaning. I don't know Left center See that's in the wrong direction Needs to be lower If this is 0.5 and this is 1.0 It wants to be negative So it was right the first time All right, and then Well, we can't move it up position Okay, so now All of that was to compute we draw this box And I want a point on that box and and the point is we are here relying on the gl matrices and stuff to do it So I have to re-synthesize that same math by hand At which point I could get rid of the Matrix stuff and do it by hand as well everywhere, but So then we're going to draw the cylinder from left leg top to left foot And How wide is the cylinder? Okay, how do we draw a cylinder? And it's not a real cylinder. It's uh Really wants to be a box cylinder a b so We want to draw a box oriented from a to b basically So we want a perpendicular to a to b So we get a vector from a to b sub the vector Horizontal this will fail and this will be Part one Let's just call it by a subtype name. Um, and that's the cross product of Axis and x Okay, so now we have three axes This one is not normalized or this one is not normalized. These are all right. So now If we wanted to use the existing drawbacks code, we'd have to rotate into that coordinate space So I am just going to explicitly compute things instead Uh Static Vertex S scale Not size. Although size is kind of just true as well. And then wax vertex point Vec So sign that to a and then we add equals scale Um So we add to point And we add x times sx times s y and we add z Times s c that's not called z. It's called axis then gl vector 3fv So then we call that Actually, let's go ahead and keep just compute it Keep using plurals. Got any singular? So we take axis local x local y Oh, sorry zero. No wait. These are in x y z order Let's put these in the same order. Let's put this at the beginning x y z x y z So the box vertex takes a to y z x y Not do it in loop order. Let's do it in binary order So now I've got all the vertices. I have to draw them That's going to be a pain in the ass to get the winding correct on all these Uh, we'll just start this is the top face. This is the bottom phase four five seven six But the winding should be reversed. So we need to reverse the winding Which we do by swapping pairs Then we have to do all the sides. I just won't worry about getting the winding correct So we add Four to each of those Then the opposite side that would be the same side Opposite side adds two So pairs Last pair of sides I am actually trying to get the winding correct. It turns out I'm trying to be consistent about reversing each edge Okay, and then these have to be offset by two Wait, the others were offset by two Is this right? Am I missing a set? Hold on this Seven No, I'm supposed to be offsetting by two wait No, I'm supposed to be offsetting by four. Did I offset these by four? I did okay Why did I say I was offsetting by two and then I offset by four? Very weird three Five All right, and then this one I offset by two right it should become zero two This one should be zero two. I don't know Maybe that offset by two wasn't right three two this one's backwards zero two Maybe that's right Okay, that's totally wrong Yeah, it's also easier to prototype and experiment with stuff. I typically use it for UI and And such the uh the compile billy All right, so why is the size huge? That I don't know We passed at zero point two f as a radius We normalize these We don't ever actually use oh we use negative one instead of size We should be radius I guess I was thinking I would do it this way Vec scale equal But the radius is still way too big Think about it point three is way too big that might still be too big too Okay, so it's the top part is in the wrong spot as we can see when it sticks out So I'm not competing the top position correctly not sure why it's rotating But rotation seems to be following the foot rotation. What shouldn't be rotating Like that at all Let's push it out to the side So I can see it Yeah, it's like from the shoulder instead of yeah, it's just totally bogus What where is that rotation coming from the aim? This should not have anything like that in it because that's the rotation of the box Is that coming from something else am I drawing the cylinder wrong and it's actually coming from the foot? No, it seems to be coming from that. Oh this We are using all three of those for that Maybe that Oh I didn't convert them from uh radians from degrees to radians So it's still in the wrong spot. That's at least consistent now. Okay, so it's above the Base instead of below it Which is this whole center z offset thing I was trying to do with Z offset minus that No, that'll be positive 2.0 That's 1.0 No, it needs to be a minus But center z offset is larger. No, it shouldn't be torso of torso base height Yeah, okay, it's not quite at the bottom. So it's still not some something's still wrong in the logic but at least that's consistent and The winding is not correct on some of the faces including the top face I thought it disabled Didn't I disable calling face calling the faces? So maybe I just have some of these wrong I have the same ones in here more than once Doesn't look like it seems like that's all the combinations correct Disabled call face Why are none of those colored? Oh, because it's the lighting Oh, and you can't change the you have to use color material to do that lighting So green is in there, but it's a little wrong cyan It's a little suspicious blue looks like it's Mixed the blue has mixed the uh Red is correct, but blue and green are both wrong Red is correct zero two six four, but blue and green are wrong two three seven six that should be Oh No, yeah Right, there's a zero There's a two and a three r adjacent here. That seems right to me. Did I screwed this up? Yep, I screwed this up. No, I didn't it's consistent negative both negative Right left but negative right left. Oh, this one's wrong Okay, okay, that looks good. So that was just that All right, so let's turn the lighting back on Oh, I didn't set the normals yet Um, the normal needs to get rotated Oh, I have these normals What happens if you use a non-normal it's normal. I think I have to normalize it. So this one I need to invert it. Okay, this one Which one is this zero one four five zero one four five So it's that and that so this one is held constant which is y so it's the y normal Let's be the x normal and then One negative one I don't know which oh, it's not normal. I see all right. We looked at this. No, that was translate Does normal have a I'm not sure why it's I mean you can't have a four. I guess you could have a two normal All right, so some of those are gonna be backwards All of them are gonna be backwards. No, it's just not even There's no brightness anywhere So maybe there's something wrong there x y and z. I don't know how that would be wrong Some side but that should be bright. I don't know why that's not Why would none no side of that be bright? Hmm When am I not thick enough We've used All we know these vectors are correct because we oh, I forgot I scaled them here. Let's undo that scaling Not an efficient way to do this at all, but okay. There we go So now yep, the sides are not really correct So let's try flipping them around So we just want to swap which one we draw when Okay, so this is gonna be better or worse worse all right So undo that and swap the y Okay, that looks like that matches except for the top so Let's swap these and we actually don't need to draw the bottom one or actually we don't need to draw the top one either Let's we get this inside the thing. So I won't even worry about this But yeah, okay now it matches So we skip drawing the bottom of the top Because once they're connected to the body, they won't be visible Although that might not be wait, why don't I still see oh because I still have kulfis I haven't actually fixed the winding yet I forgot I left that on it seems to be Rotating backwards, which means the winding is backwards for all of them Joy six zero seven three two seven five one three Four six two. Oh my gosh, so many immediate mode questions Uh, and I broke something I think no, maybe not just looks funky That seems to flash a lot while it's changing directions. It seems like it shouldn't flash that much So let's go to slow mo and see what it looks like in slow mo Oh, it's partly because it's the discontinuous pop there, but I feel like maybe that vectors aren't aren't all normalized That one's normalized Seems like all the vectors are normalized They're normalized right there All right, I don't know. I don't know why that's happening Um, I guess it's good enough. It looks weird to me, but Either it's a bug that I don't understand or it's actually right So let's not worry about it too much. So let's draw the other leg And then we'll actually finally get to doing the knees and the ik Jesus. I'm singing forever power 20 Oops, I spilled it Right left right leg Um, so then this has to be positive. Let's move it inside Oh, what we wanted to know why it was too high. It's still too high So I don't know that the center is the offset calculation is right. Oops I thought I renamed everything change the foot name So that's as expected. Why are those not at the base? So this whole computation must not be right I kind of see the pants that so the position is where the feet are And then we add center z offset To get a center of rotation So it centers the offset above the feet Is the center of rotation? so then we want TP towards a base height above the ground What we need to convert to the coordinate space where this Is the center So this should be larger than Than that maybe torso base height is 1.4. So as the offset is 0.7 They're the same Is it coincidence that there are you know what off-life factor to is a coincidence? No because one has been computed from torso base height Yes That's not the center That is not the center. That's the bottom of the that's the bottom of the Is that but it is rotating around that That's the bottom of the torso not the center of the torso it's not even the bottom of the torso if that's torso base height What is going on? What is this code doing? I don't understand So it's not rotating around the center So when I move the feet I burp this So where do we want to actually set the position? The position actually wants to be set to the center of the torso So where's the center of the torso? Okay, so the center the Center of the torso is tp torso base height Plus half the size But now this will just be positioned totally wrong. Yeah Okay, but it did look like the bottom was now in the right spot But for the left leg which I because I haven't fixed the right leg Yep, it is. All right. So this math is correct So the old thing was just wrong because the torso base height is not actually the torso base height But it's also drawing too tall now. So I need to figure out what that is Right because I should fit under here Um, maybe I should use torso center height Then it'll be a lot clearer what everything needs to do So the size is the height minus the torso base height seems correct and yet it's drawing way too high How can that happen? What do we draw for the main body? size centered around position Yep, we draw size centered around position size Is why is that and position is supposed to be the center? How does that not work? What am I missing? What am I missing? Why am I not thinking of here? Stupid coordinate systems Okay, why is the bottom so high? Let's answer that question first T height 345 because torso base height is way too high But why does that result in the total thing being drawn too high? pos.z Well, it's centered as the offset plus size z Center as the offset 2.5 size z over 2 Is 1.05 so it should draw up to 3.5 Which is correct My logic is it should draw up to a height of 3.5 for the top of the torso. Well, it's not the torso. It includes the head now Because it should take center as the offset pos.z is where the feet are. Is it where the feet are? No, it's not. It's where the center is Let's get rid of that. Of course, we were already passing that in. I'm not sure what that was for Anymore Bottom z It's for deciding where the feet should go. Okay back down to what it should be now. We just need to fix the right foot Yeah, okay, so it was the one it should have been all right So now we've got the feet at the bottom so we can move them Back in There should be like a skeleton properties for where to position all these things instead of Doing it by hand This is going to leave a gap if you get at the right angle Okay, so there we go Why do they go sideways? When I'm moving I move forward so it's not using the right angle I either passed it in as the wrong axis or It doesn't happen this way but this way They move to the side And this way they move to the other side So there's a consistent bias in the x direction When you tilt It isn't being handled correctly Um, does that mean I'm rotating the vectors in the wrong order? Maybe where did I put that? I just up here somewhere Or did I add it to vector? Where did I put vector rotate? The rotate vector In world for no good reason Do I need to do these in the other order because they're Object space to world space not the world space to object space Yes, I do okay, and they don't the cylinders don't rotate Which is not correct, but it's because I'm doing the x the way I'm giving the x and y axes for them All right These are really short legs Let's raise the bottom of the torso a little bit 1.4 is pretty high though 3.5 Am I doing some math wrong? Is that actually 1.4 blocks high? Are those legs actually 1.4 blocks high? They are taller than a block Yeah, I guess they are 1.4 high. Do they need to be high or not? What's a real person look like? What does a human being look like? I'm back to search for Oh, they're almost halfway up Maybe 40% up So they're 3.5 high and we go 0.4 up. It's 1.4. All right. It doesn't look right, but All right, so now we want to put in some knees Oh, let me check that in now. We want Left knee Vec Lerp Halfway, is it Or even Because of the way I'm drawing that I think that's gonna be More reasonable Now, of course, this will not even be visible because it will just be Left it's just going to continue where it left off and probably not be visible at all. Oh, uh, okay, that's a weird Behavior, um, did I miss a right and a left somewhere in here? I left out the Vec Lerp I did it's right there. I left out the draw cylinder. I changed the wrong thing Vec Lerp, right knee Right foot This is supposed to be right knee I like top, okay Okay, so you can't see the knees because they're in exactly the same spot And so now we can do the IK So if something I can do to make that visible, yes I can draw this one a little fatter and this one a little sinister I really should make those legs rotate The right way I don't know. It's kind of a cool weird blocky effect that the blocks stay aligned to the world Maybe that'll be the distinctive art style aspect of this So yeah, so this could be a robot Because the whole thing is it needs to change lengths and so You see those as being sort of piston-y Things as a robot that's just automatically doing it Um, of course, this whole tilt here just doesn't make any sense I really do need to separate the head out because that's part of why the proportions still look wrong to me It's because it doesn't turn into a head at the top But let's try to do the IK Okay, so here's what I always do when I want to do this kind of IK it's to link IK Paste the link into chat So what I always do is I take this code and I convert it into my vector library and just don't even think about how it works Because he's solved it. He gives you the derivation if you care about it And so I just need to copy it into my code. In fact, I ought to just have an stb If you just have an stb IK Oops, I wanted to move this off screen. Okay, in case there were secret libraries that people didn't know about but um Yeah, I don't have I don't have this as a separate stb library, but I really probably should He doesn't use the math library. I mean he doesn't use a vector matrix library to do this Oh, he does he hasn't no much. Oh, no, he has it right here So, yeah, rather than using my vector library if I do this I can just make this into an stb lib. So let's do that Um, do I have a util? Yeah, have a util. It's a solve function. Does it have any separate? I don't okay, so stb Should I use doubles to get that extra precision? I don't think so To link IK So we're going to output matrix Q is the solution How does the return? I guess you access it out of the thing Find any position q and then what is this? Return Oh, it's just a boolean. So it returns an int It solves q that's a matrix. I'm pretty sure double array Let's say how long it is That's how he does that's how you notate Oh, right. This is just finding the point for the knee, right? It just returns a point It's float and what do we take we take Do you link to like from zero zero to an effective p? these are Not arrays p Okay D what is d here? Oh d is the preferred direction. That's right Float And Because this is the api. We'll do this do it this way or I don't have to be so narrow um And for my Mid So I'm trying to not be a knee because you can also use it for elbows and you can use it for totally unrelated things Let's call der after all And What are a and b the lengths these must be the lengths, right? Length lengths a and b let's float to end land Let's float Start to mid the land mid to the end land Um If I call it n should I call it start or begin? I guess I should call it begin begin and it's normal pairing And He does it assuming that you're at zero zero and you Uh offset it yourself. So let's make that explicit. That's the api Now let's rename the variables That way I can match his code These don't get to be const because there that seems to be the same as what he has so now we can actually Going here and do the various Other functions so Static And that's just taking the norm. That's not normalizing which I call len dot Norm normalize. Well, let's just use his convention. So I don't get it wrong We'll notice I'm retyping it all instead of cutting pasting his code even though it's going to be exactly the same Um Just to give myself a little bit of Calling this public domain Probably can't really call it public domain unless I really wrote it from scratch. I don't know What's his license on it? I guess that's why I've never done this is because he doesn't have a license on it. So I don't know Um What his intent was for that and so I don't really want to put it in public domain because I copy it so closely I guess that's why I've never done this. So maybe I can't do it Maybe I'll just say it has the ken purlin license And zero times be of one minus a of one times be of zero because like really that is exactly the same Rot Float while he puts the sign in at the end I should probably convert that to my style and then I'll screw that up and forget to change it the other things but Destinations on my buddy Let's be consistent Um because I did that already for the api Uh That's the entire math library got this helper function Get that out anymore Find d that's right min A and that The smaller of those which means Clamp that to be at most a find e Not here So we can put it into the stb lib It says it's a public class Uh Yeah, so I I don't know what that means in java Um Whether that means you're allowed to inherit from it or whatever, but I don't think it matters in any way Um, we're going to have to find e Where was I know on my screen there? And then it's going to eventually use define m So we gotta do define m first and add the Camel case convert the camel case to this instead of running it together So define m Is going to assign the internal m Presumably Maybe it's gonna assign both of these. What's it gonna do? m fluid and m in Where does it compute m in? I mean it's passed in No, it's not Define m I mean it's not set up before that How does that work? Where's m in coming from? Creates r then calls define m The very first thing it does is Oh, this is making these three point to those parts of it and then it initializes x initializes. Okay So So let's just make those be Three separate things explicitly. Do we ever use m in again? No m forward is copied out of m in So I don't even know why that's global Why that why that's not a local to that function? Because He never uses m in Again, it's just defined in this function and then used in this function Okay So in the end what we're going to do is define m Like the name says And so I'm not going to const these So we take my spec up Take pnd Three That's just a sub scale if I were using my vector library You can see we're just computing some kind of coordinate system Then we say cross And we change the order of that What was the other one I changed to the order of? Besides cross Rot we haven't used rot yet. So it says to be i k cross And then we just copy those Oh, notice how it's swapping interesting. Ah, because it's doing a transpose Okay, so m of Three plus zero equals That's x and y I believe this is what that code is doing. I could be wrong. I don't believe that's what's doing Then we just have to write this function solve Declare that's this Let's change this to q Let's do this float. So we have to worry about that and then we define m so we define m We rotate so I did all complete. I've got that destination It's the last one These in the same order Oh, it does use m in there My bad all that n I'll call m in m in We have to pass that in Have to use it float And then we do the same thing he did x equals m in Zero D I think that's whether it violates the length constraints Is what the return value is but it still returns you something um So we rotate m No, it's not called d. Oh, I have two d's. I see um All that's the d vector Where do we use capital d to find m? I think that's the only one. All right. I think that's it It's about a hundred lines of code got my asterisks Check them out in the chat. Uh, it's a public class with a public domain reference. Okay Yeah, it's it's not that I take everything literally it's that I lose the context So I didn't know because of the twitch delay and because of the delay in me looking at the chat I just don't know when people make comments. I usually don't know what they're in reference to And I have to guess why did I start typing that I have two s's that's great. His code is so awesome I wonder who was using capital on lower Or did I Is that me Why did I call one of these s? Oh, this is my origin my start Right. So this is my own naming I forgot to do that work Okay, so Here's what we want to do We want to say float s That's unchanged The direction doesn't change. So p is the only thing we have to do p is p of zero minus star one two minus star two Where did r come from? Oh, he explained it. All right. No, Len, right? Right, right, right. All right, compiled So Let's put that into wgfunks for now And let's try to use it So that's in main knee All right, so now instead of lurping to compute the knee We want to do this. Oh wait, we need to add it back Let's start offset q of zero plus equal to star Oh, we don't have the loop variable in here We can't paste it So now the only problem with this is if it's wrong It's a pain in the ass to debug because which is why I want to put it in the library Um Because who knows what I screwed up. I don't understand the code. So it could be anything. All right, so We want to do std to link okay And then we need the knee direction. So this is Which direction the knee should push out? So it needs to push out in front. So we need the forward direction Which we can do by doing a rotate vector Back forward and I said forward isn't uh, Is in that direction? Oh, and we could use this to make the cylinders draw in the right direction. So we just rotate vector forward Okay, so I'm right we're taking more than one vector by this so making the matrix would actually be better, but um So that's the forward direction the lengths So how long are the legs? Um What was the torso distance 1.4? So they're each about 0.7. Let's make them just a little different Into midline Okay, I think that's all it so that just replaces our vet blurp Extra parameter has type void There we go Then if he if he's on that step down it should extend the way down Yeah, and it can't reach so the knee is not you know reasonable place because it can't reach All right, so let's fix the right leg So it looks like it just worked. I didn't have to debug it. Thank god Despite all the random changes I was making because this is just terrible. I need to reorganize this code This is not me reorganizing this code. This is me hacking it to compile Um, there we go Doesn't really make any sense the tilt to me, but I guess it needs to actually The problem is it's tilting around the center of mass I made did all this work to make it tilt around the center of mass and that's not correct It wants to actually tilt around Uh feet, I guess because it wants to be leaning forward it wants to shift its center of mass forward So we actually want this rotation To be around The feet which how do you even do that for this? We actually just need to push the position forward Um, how do I want to do that? How can I do that? How do I tilt the body? How do I change the center of rotation easily? I just can't use draw box Because draw box is always going to rotate around the center So do we already have a modified version of this? It doesn't look like it So draw box Voila, now I have an uncentered one So now the coolant for this is negative size x over two negative size y over two Two size e over two. So now that should be unchanged Yep, okay, that looks unchanged to me. Okay, so now We can change that to Go from zero to the size of z and the position is plus size j over two Wait, that still puts the rotation in the same spot minus size z over two because I've already centered that position Yep, okay. Now it's leaning forward It's rotating around the bottom of the torso, but I want to rotate around the feet So for that we have to push this even further Uh, this is tp arrow torso face height Actually, let's just not offset the position by that, but then this is tp arrow torso face height I'm not sure what else will break when we're not offsetting the position though We don't need the center of the offset. That doesn't exist anymore That should still be that for the size and then where else did we use pause? Because now I've changed pause.z Okay here The I need to fix that Yep. All right, let's check So all that work I did to figure that out was all irrelevant. Oh, no, I screwed something up But is it rotating around the feet? It looks like it's rotating around the feet to me Right the front the bottom front of the torso is now moving forward and it didn't used to it used to just rotate All right, so I just have to fix the the height Oh, right because it's shrinking the size I was using the size.z. That's what we want. Yep. Okay. That's back to how it was and it leans forward Not very realistic lean forward, but makes way more sense than it did before probably should lean forward faster Maybe not. I don't know. All right Done with you you till All that info now and we can close that Realistically the tilt indicates acceleration not speed. I don't think that's actually true um You're shifting your weight forward based on your speed um Once you're running at a stable fixed velocity you still are leaning forward um You don't run straight upright It may be that it should not be a hundred percent synced to speed I see. Okay. There's a follow-up message It should tilt while accelerating, but once it reaches constant speed the tilt should decrease not completely, but it should be noticeable That probably makes sense um We can do that the angle is not coupled to Is not nothing relies on the angle um Like the angle is just computed from the velocity currently so that can be a to do Um to make that more realistic and we don't have to do it this instant though 13 Fix body tilt to Tilt more while accelerating lean when you in a vehicle um No, because instead of using leaning to keep from falling you have a seat behind you that keeps you from falling If you're on a motorcycle you lean forward um But yeah, yeah, I understand what your point is there in a motorcycle Uh, if you didn't have the air blowing on you you would be able to sit upright because it's a fixed strain so Um, there's no reason to tilt but the way running works is that you're constantly falling onto your feet So you intentionally want your body to be ahead of your Uh, you want your center of mass to be ahead of your planted foot And so you lean to accomplish that I mean the right thing to do is pull up Uh, hang on a second, uh, right thing to do is pull up a video and look at it But I thought I had a reference book for this but I must have gotten rid of it in the great purge I did last year or six months ago or whatever Yes, I'm not gonna start running it from the camera I will just bring up video if I care about but like I said, I think it's a little priority to get all those tweaks correct Um, all right, so I I want to make the skeleton more realistic so that things don't look so weird. It's too confusing um So So we did iK likes to foot So let's move the head. Let's draw the head. Um, because we now have this draw cylinder stuff as well, but um So Another box where size coming from by the way Let's not multiply by two and then divide by two In fact, we can wait. Why is that not? Why did that compile? Just tp Half size x size y And we should probably actually switch this to torso size Because these sizes are where the abstract physics sizes. There's still a size in here somewhere. Oh, okay Now we want to make it less tall Draw another one And it's going to go all the way up to height It's going to start f And the head is going to be I don't know how big All right, that's way too small. I think There's the whole heads Head size rule that unfortunately that artists have that I don't have memorized Um, I guess I could google for that. Well artists use an exaggerated thing. So we'll go with This wikipedia 7.5 heads. Yeah Okay, so head height is 7.5 We subtract out the head height. Although, of course, there's actually the neck And then we and then the torso. Yeah, so we start needing the skeleton proportions here. So let's go ahead and so forward What if I should do the head of two boxes rather than one box Do these as proportions? Let's just make these consistent We didn't make sense to work from bottom up term position feet the knees then mid-ripped Um Yes, but Not the way we're doing the animation system where we start With a physics representation that is the whole body We know where the body center of mass is And we kind of have to obey that and then we'll we'll cheat it where we have to Um, I mean, yes in the sense in in the sense that you're talking about that is what will have to happen in the long run The torso will have to be positioned properly and the way we'll adjust the torso is based on where the feet are But It doesn't necessarily make sense to go in that order in in implementing it Um, we can allow the legs to stretch like they are right now and still try to get everything else, right? Keep that in sync. Unfortunately So then the head These are going to be proportions So Let's actually just get that out and do this So they they have to be normalized basically Yeah Yeah, sure. Yeah, let's require normalizing. All right, so um Let's do everything out of a hundred so one seven fifth Times a hundred is 13.3. So that's the head z It's like a head y It's about the same and x is a little smaller not positive then the torso looks to be Looks like that is actually at about 50 percent that point right there where the joint is width will be The full width so wait, so are those widths in a different unit? They are Uh, so I actually want the widths in the same unit. So the width is What three head is wide a little less two heads wide? We'll see we'll tweak it Doesn't have to be perfect. Anyway, and then the depth is A little deeper than the head Something like that I guess we can just make these decimals. I have to put all the f's in that's annoying part So these are all relative to the height Shape Okay And then there's still how to position them, but we'll come back to that Like all the ik wants to be relative to the torso So you have to figure out where the torso goes and then Which will depend on the way the feet are and then do everything relative to the torso um But this is all still kind of hacky because it's Ground distances not based on where the torso is, but that's fine. We're just trying to get it working um Why is this curly brace is not matched? Did I start to change this? Yeah, I did Let's see. This should all be height. Of course, that's just a vector scale Oh, but this isn't in a vector. Oh, these aren't tps These are just plain because I just computed it So this will leave the head centered. I need to push the center head off center But and then the torso base height needs to be adjusted to be based on the torso z And then that means this stuff is going to be computed wrong because it's not using these things It's still using torso base height. Okay. I don't think I got that right That should be drawing all the way up to tp height tp height should be 3.5 3.5 and then 1.4. It's actually less than half It's going to push that up to one half That'll make it even smaller with this bug. I think And this is wrong because the critter is only 2.5 tall. So we want to make this be 1.25 um I guess it's a little bit bigger than One third No, because we said that point should be halfway. So then that plus the neck So what's the neck height? Well, let's just make them not a neck thing as well about half the width The height is Very skinny for your quarter of the head height Okay, so then these three need to add up to 0.5 Does okay Now this minus neck dot c missed my draw box on standard head height Except no now the feet are up too high But the body proportion does seem better So what happened to the feet? Oh, because I haven't adjusted that to use any of this stuff um Although that should still be 0.5 Using the old thing it should still be Is that what is half of that 3.5 1.75? Yeah So i'm not sure why that gets the height wrong But maybe the logic's just wrong now um So the left leg top, let's do this torso bottom torso torso top equals T height minus and z minus neck z So bottom equals torso top minus torso z and top equals Tp height head bottom equals tp equals head top minus head Neck top equals head bottom neck bottom equals neck top minus neck z torso top equals Head So this is the thing you were saying about build from the bottom up except i'm going top down And i'm going to have to change it all to be bottom up eventually relative to the torso position at some point Let's neck use that stuff here bottom all right Sure, I'd buy that It's just the leg positions are still wrong and therefore because the leg positions are wrong the ik is gone as well um Why are the leg positions wrong? Because this now needs to be Bottom so the whole reason I did that is to make it all clear and consistent There we go And now we gotta get the left right positions correct So this is torso x over two Which is negative and of course these are not normalized There we go Um, that's not right They're supposed to be exactly lined up and they're not exactly lined up the torso width Where do we draw the torso the torso width is torso x over two So we take teraxo lex over two Oh, these are radiuses not widths Yep, there we go Now it's foot placement is too wide And the legs aren't long enough because I made the things longer So the legs need to be Because I'm not moving the torso down. I'm going to make the legs longer than they should be So 0.3 f 0.3 f fix the absoluteness of those at some point. And so where do we do that? We do that Here boom these That's kRL lower my leg length Steady height Count me this down They used to add up to 1.4 now they'll add up to 1.6 or something like that Which give them a little bit of bend Yep, okay All right, so the legs are too long. That's expected. They need to Be exactly the right length when you're standing still And then move the torso down when you're running The question is if I set them about the 2.25, is it exactly the right length? It should be and I don't think it is Oops hit the wrong button again. Come on. Yeah, I don't think if I set these to 2.25 it's going to be Exactly the correct length. So I still have a bug of some sort Something is miscomputed. What would my bug be? What would my bug be? Let's not make the speed dependent on the tilt that's been in there for ages Where we compute the speed maybe world? Oh no in it's in physics We compute the desired speed here. Don't we? Where I don't see it where we compute the desired speed. Oh, let's do that external Yep, here's where we do it. Where do we adjust for the tilt? Ah when you're going uphill and stuff it should do stuff different, but okay Now it does not slow down when you tilt Side stepping makes no sense. That's fine. I mean it is actually Making sense part of it, but uh not the upward movement, but at least the foot planning is reasonable All right, so So did the widths match now? Yeah, they do. I forget. What was the thing I was working on? Oh, right trying to figure out why the legs aren't straight Why is the leg length not correct? So the legs add up to 0.5 This adds up to almost 0.5. So they should meet The available space for those should be 0.5 and the length should be the legs should be 0.5 Break in here and see what's going on So each of them is 3.5 times 0.5 0.875 long and then where is Left leg top torso bottom 1.785. What did I just say it was? Yeah, the total leg length should be shorter than torso bottom It's obviously not This is relative coordinates though, so it's confusing Maybe they are going straight and I just don't see that they're going straight. No, they've got a little bend Why do they have a little bend? They should not have a little bend What am I missing this also includes it probably needs to be data driven So it looks so it's more coherent got body parts at various locations and and stuff The feet shouldn't be centered. You need to fix that The head shouldn't be centered you need to fix that Let's see. What's the neck the neck is 0.5 So What's the difference between it and the neck 0.8? So it should offset by 0.4. I think and then the feet. I don't know how big the feet are feet are in absolute feet 0.2 0.4 0.1 So 0.4 is the long side 0.2 is the short side. So we want to offset them by 0.2 feet forward offset But those are using a centered box currently, right? Then let's add the forward offset, which is in the y-axis Oh, I could have just done that directly Let's leave it. Let's leave it the way it was We just have to do that here. We can change them to uncentered later, but Oh, no, right the reason is because the rotation No, that's okay. That just does the same thing Uh, and then the head Perhaps a little too far forward it almost goes up to the the chest. So let's make the head A little bit shallower forward offset still too far forward. I wonder if I'm changing the wrong variable or something No, okay, still too far forward. I guess the problem is that the torso shouldn't actually The neck versus torso probably isn't right either Or is the torso just too thick Yeah, the neck is a little off-center And I guess I included the arm positioned when I tried to estimate the torso thickness It's probably too skinny But it's one big block. So it's really kind of confusing because that's not really what a torso is All right, good enough doesn't have to be perfect right now All right, so why are the leg lengths not correct back to that? What am I missing? Left leg top torso bottom and we rotate that into the space, but we're not tilted so it shouldn't change anything Then we add that relative to pause So we want to look at we want to force them into the planted state I'm scrolled right by it. What am I doing? So we want to force this So now the right foot should be Stay planted. Oh, yeah, that doesn't uh, doesn't really do the right thing Um, let's just replant the foot every frame. Oh, it is straight now. No, it's not straight Okay, I see. All right, so now I can break in there and look at the right foot. Okay, torso bottom 1.785 and then right like top 1.785 Okay So the top is at the right spot Now it should have to cover 1.785 right leg top dot z minus right foot dot z That's shorter. Why is that shorter? Oh, because we the foot is up above the ground a little bit because of the foot has height Where do we do that? Where do we compute the foot plant? Uh-huh, we have that No, that's not the z. Where's the z? I think x y That's x That's the sideways. Why is the thing a y right? On y left. Yeah, those aren't the heights. It's a z left and z right. Okay. Here it is. This is 0.5 So we need to compensate for that in the leg lengths So 05 over 3.5 so 0.015 So the leg lengths need to be shorter by that much and then maybe they'll be straight That's good. Now I have to move the torso down to fix that That's straightness And we'll do the hack that we had in before which is make the legs a little bit longer so that they articulate Rather than fixing the torso yet Then we want to disable this planting All right, so now I think I understand what's going on And so we can put we could either do the arms that the Luger 2 demo has That just swing and don't accomplish anything or we could do something else Wow those Legs have a lot of reach. I'm barely I thought I barely increased them went 2 5 to 2 8 It's crazy how much play that gives them So it's be a longer stride now We're running. Oh, I got what it's okay. There. Let's just work with multiplayer There is some multiplayer support, but I didn't really have anything To show in the multiplayer. So I stopped working on it and moved on to other things Uh, but now that one of the things this is for is in first person You won't ever see this but it lets us put the AI creatures have the same animation and it'll let us have multiplayer Have the same animation So that's definitely one of the goals Um, okay, so back to our list Draw a separate head So we have a bunch of stuff to do with the feet We have repositioning the torso So yeah making the feet continuous I don't know. It's actually interesting that even though the feet aren't continuous once you put the legs in somehow It's more tolerable, right? Like that is They're actually not continuous. They're popping still there Well downhill is totally broken. We know that so let's not do that. Let's go back to the flat running case You can see how it's popping The torso is moving smoothly because the torso is Being drawn where the center of mass is and we made the center of mass move up smoothly Um, but it should actually probably just be driven by where the feet are and obviously the feet the knees going through the The ground is due to the feet placement not actually Targeting the feet placement. So that's what the compute the foot placement ahead of time is for is to make those I have to we'll make those things actually step up um, so that those are the two big things about the feet placements that they're actually discontinuous and um And planning the foot placement ahead of time and then avoiding the leg stretch will obviously be Uh, so we could fix that maybe don't stretch the legs Because we actually get a thing here where we return a bullion From this so if that fails couldn't reach Foot position Then we can compute a new foot position based on what we could reach which is We want to alert from That's actually an extrapolate instead of an interpolate No go from the left leg to the left knee We're going to keep going in that direction Out to the way the left foot is so what's the interpolation amount for that? It is a upper we want total Leg length Divide by just the upper leg length see if that works Yeah, that seemed to like while he was falling it didn't seem to be stretched Go to slow mo Step up And then step down step up won't be affected. I don't think So that was never At the limits Go ahead and step up again. And now let's step down So now it won't extend all the way down or to tell what's going on Oh, I see they're planting into midair and you couldn't really see that because there's no shadows This hill so we can run downhill a lot. I wish I could see the feet better. All right Yeah, so they're planting in midair and they should just stop planting. They should flail or something probably Well, they should just see they should anticipate where their next planting point is even though it's way down I guess it needs to switch to a like a jump pose or something but All right, so yeah that avoids logs from stretching. That was trivial legs Uh, and then we can do we can do the liver two-style arms. I mentioned that So what do we think foot discontinuity? um Foot discontinuity torso adjust um What's the problem on the uphill that's from foot discontinuity. It's from not plant planting planting the foot placement Um, so let's let's put this into a structured thing part of the torso. That's a nice Structured list Nobody had any opinion on what I should do The way this will work in multiplayer by the way All of the animation here is driven by um A physics that just treats the object. Well, not literally a sphere but basically like a sphere in the liver tube the atmosphere and Uh, just they compute some animation that is consistent with that position and velocity So we'll just do the same thing networked. It won't actually network the animation It'll just on every machine compute an animation that's consistent with the positions So it might look different on different machines So if that mattered for gameplay if like where in the opposed you were matter for gameplay like you're being shot at and hitting your limbs Mattered we'd have to We'd have to actually pay more attention to that But I think even in that case I think it's okay If you're trying to hit a limb that's moving You know if you're trying to shoot a limb that's moving it's and the limb is in a different place and you miss How are you going to know? Like if you had slow-mo you could consistently hit a limb But you in multiplayer you can't do slow-mo. So I guess if you had Enemies that moved really slowly so they were effectively slow-mo That could matter Oh and uh to do At the state so another thing we could do is actually hook this up to the ai's right now We try to make the ai's Have this stuff It's only one of those used player id even though it's supposed to be passed in Oh, I can't use alge all right Let's see if that works. All right Find where we draw the ai's critter Position is that offset? No, it is not bottom z. We don't have a smooth bottom z So we can't Now I don't remember if they set their angles or not. Nope. They don't turn All right, and they're smaller which is expected make them just a little taller But they can fit in places we can't fit so we can't make them too much taller and then We want to make them while the path following they need to So ai did I ever make an ai dot c? I did not so the ai is still in the world Path follow what did I call it path follow path find ai tick So when he changes to a new direction When he sets this velocity boom, we want to Oh arrow n dot z equals a tan 2 x but those might actually need to be reversed Because uh because i'm using the y forward system so I may maybe need to rotate that. They do not seem to be turning at all No, they ain't turning at all. What did I do wrong here? That is where they pick a new direction Velocity y and velocity x are correct Oh because that's in that's in radiance and i'm storing Storing them in degrees for compatibility with gl Okay, now they're turning sideways From where they're actually going by 90 degrees because of the thing I just said So do I just need to swap them or do I need to get negate one also? I probably have to negate one also Wait, those ones are correct and that one this side. Okay. Yeah, so I'm gonna get one of them I guess it's y Nope. No, they're just going backwards the whole way Well, wait if that were true then I should just have to No, I see I have to negate both right. Yeah. Yeah. All right. Looking good Did you didn't you make pathfying look for paths only two blocks high now? It looks for paths that are as tall as whatever the Thing the size of the physics object of being path found So these guys are three units tall so they can fit So I and I'm four units tall so I can't fit under this But they can But I can fit under this so then if I put them on the other side of this And tell them to come to me. They should be able to go under Okay so That did that can't commit a link animation date biped structure Okay It's amazing. We get the exact same comments every time when people come in. Yes, they do And we have a giant list of things that we have to get through before they look correct We've already gotten through a fair number of things on the list, but I just did that. I haven't been leaving this up I don't need my proportions anymore done in today's stream I k better skeleton well better model Um Well, since the foot placement discontinues isn't that noticeable. I guess we'll not worry about this is an optimization So it's not high priority yet So I guess we can get people to stop complaining about the standing still not existing so So do you just dynamically compute what state you're in based on your velocity or Do you want it to be a stateful thing that you set and unset Let's change this animation state The animation phase Let's actually do that All right And we can take out the word animation Because it's part of a structure. That's the animation. So we that's redundant So animation phase becomes phase And then We can have a state But I'm not sure whether it needs to be stateful or not Let's move this skeleton Definition up where we define the biped animation states Um, we can have an int state but then what's the uh, what's the phase currently? It's currently in units of Radians just probably a little weird Okay, here's where we compute the speed 20. It's a hard-coded 20 We do have sk. Why did it not autocomplete my sk? So it's not really cycle period Because it's 20 Okay, so if we have A delta t and then we have a period we want to divide it by the period And then multiply by two times and pi and then the cycle period is state So we're going to have About six Divided by period has to come out to 20 So that's a period of about point three right right because that was that so what is an actual running phase Like like how long does it take between placing the right foot each time? one Maybe two per second Maybe less than that So stopped zero that'll divide by zero though walking I haven't any good idea. Let's just do that to start with Um, and so then animation dt. Okay, let's I see If The a state is not equal gate stopped then we can update our phase. Let's just have a bowl Stopped so we don't have to keep checking that multiple places if stopped we do that Otherwise we'll do something else So if we're stopped, we don't want to update the feet planting at all Let the feet planting be whatever they are Or maybe you don't need to keep checking stop because that's all isolated there So then We'll just do a dumb thing to start with be a state equals mad 3 equals 0 8 not state Okay, okay, that didn't work I did weird things what was falling Because it left the feet planted and left the feet stay where they were Now this I guess I just got these times wrong. I didn't do the math right when I was trying to reconstruct the math It used to be times 20. It's now times six divided by cycle period Which needs to be about 0.3 to get the old speed Oh, and we'd set it to what do we said to running or walking? We said to walking. That's why I was doing the walking walking pace is too slow But it seems reasonable And then it doesn't stop Okay, so why does that not stop? stopped mag zero Oh greater than equals zero Now, of course if you're moving really slowly, we don't want the feet to stay planted. So it actually needs to Yeah All right, there you go. Now they stop They go through a dumb state while they're falling, but that's fine If they're if you're falling straight down you go through a dumb state So we need a free fall state as well I'm sorry, I threw them in the wrong direction because I wasn't facing forward And now they can't get to me. They're all jammed. All right, their feet are too wide I should fix that Didn't you think pathfinding looked for oh, that was the old one lost my position there Wait, that one was negative, right? No, okay. That's negative. That's negative. That's positive. That's positive. This is positive. Okay, that seems right Oh, yeah, I do have to add that. Okay. How much should the feet be spaced? They want to be under the torso The torso is point two zero wide So It's the center of the legs Why are they off center? I got something wrong. One of those is negated incorrectly The right foot is positive The left foot is negative. The left foot is negative The right foot is positive. Okay, actually useful data here So I didn't commit between those I undo it Back to what it was Save it Get commit and what have I changed at this point? Getting gates. I'll redo All the stuff I just undid Okay, and now I'm getting Foot spacing, sk foot spacing times dp height over two Point three five changed to foot spacing Point three five changed to foot spacing negative point three five They all look like they're on the right. They're at the correct side-ness All right. Well, let's just change it to point three five Check whether it still looks the same or not Yeah, I think that's about the same as it was Okay, so why is it when I made it smaller? It blew up. Well, they blew up. It just became inconsistent Yeah, it's popping in a weirder way Uh, I know because the foot search isn't using it foot search foot search foot search Find foot placement poly Boom right there at this spacing foot spacing plus Oh, I don't need to use It's minus actually I don't need to use the f's in this file foot spacing plus thing for two It's not quite the same as when it was But whatever right now they're Into tight Wait, is x i left as two point two five hard-coded foot spacing? No, I didn't make it hard-coded. Not perfect, but good enough What you do list So walking running states with different gates We still have a lot of cleanup to do here. We need to actually Find a good foot position when stopping Which is this So The moment we see that we're stopping We want to compute new foot placements and animate to them, but we don't already have the idea of We don't already have the idea of Of computing a foot placement once and reusing it So we actually do implement stopping correctly. We actually need to foot placement improvements So we actually have to do this stuff first So maybe I'll put into our animation Now that's a bunch of work. Let's just busy work Maybe I'll stop Three and 45 Three hours and 45 minutes. Yeah, I think I'll stop now. I think we'll stop there Uh, so go ahead if you have any questions go ahead and ask let me fix that again So that was these so I made this match gate Cycle period takes gate gate this index zero one should be okay. I'll push it What else did we do in today's stream? We Better model I think that's it. All right, I pushed it not that I expect anyone to actually use it, but that's fine And nobody has asked any questions so You give me another 30 seconds or so 22 notifications It's good. I was seeing a little argument when I stopped my start this What was your Criteria for taking that particular iK solver it's closed forms. It's not iterative. It doesn't have to solve It always solves exactly the same way It's not position dependent. It's very simple code Um, so I just I always use that. I've never done real iK. I just always do two link iK You can almost always do that for human body stuff like if you want to do fingers um You probably can solve for a hand position independently and say here's why I want the hand to be um It does not this iK solver doesn't allow for orientation of the end effector So your hand has to have a flexible joint like the fact that your Whole arm rotates around this You you would ignore that and make that be part of a hand rotation And if you want after the solve you can propagate it back out to the arm But that's what's kind of a separate thing because the arm actually is the sword twist. It's a weird thing Anyway, the point is if you solve for a hand position and not really the hand position but this the position of this joint so you can move This two link iK system from the shoulder to here Based on the solve for where you want that to be and then that you can do like a two link iK for Like maybe you can figure out the hand orientation natively and then treat the fingers as two instead of three And use the two link iK for the fingers and so you would be able to actually do um Solve this full thing Including the fingers by splitting this out and doing this cheat where you have to Have some logic for where to put the hand Whereas a full iK system could potentially try to solve all that at once As soon as you have more than two links, it's not closed form as soon as you have three links You need an iterative solver um And so we just stick with the two link cases and that makes our life a lot easier Would the code have to change much in order to support keyframes like an overgrowth? I don't think so But like I said at the beginning, I do think the overgrowth system works in a very different fashion So it starts from a very different starting point But I think it ends up in a place that's not that far removed um Because he still is doing iK for the feet and most of what we spend our time here on what's the iK solving so He would take a keyframe Do the keyframe animation for which it's totally new code doesn't exist here. You'd have to write it all But most of what we used here can still be used because most of what we wrote here is solving the foot and knee placement Which you still want to layer over top of the keyframing you still want to fix the feet and potentially hands So it would be possible. I don't plan to do it because I don't have a tool for editing keyframes Um and the model is purely procedural So I don't even have the skeleton exported in a form that can do it So I and I don't plan on trying to do that I don't plan on trying to find such a tool or write one I figure I'll just leave it in this sort of procedural style because they're going to be blocky models anyway So I don't think it's going to This may be overkill even it may be better to go with so the minecraft this minecraft not have the knee joints I don't remember. I think it doesn't I'm trying to remember what Ace of spades did Oh, this is the advanced ace of spades not the original ace of spades So, uh, so busy. It's hard to tell what's going on Classic ace of spades. What do you what do you call that? Oh, yeah, those have jointed arms and jointed needs they do. Okay. Yeah, there's the Yeah, okay, so they do have jointed limbs All right. It's not third person. So it's hard to here we go Yeah, a much more cartoony shape too um I don't remember. Why was I looking at ace of spades? We were talking about the keyframes and overgrowth or whatever And I was saying I probably would never do that and just do procedural animation Okay. Yeah, so it was just a question of whether That stuff already existed in minecraft and I decided to look at ace of spades instead of minecraft because who cares about minecraft Any other questions the whole thing where their feet get stuck above them is insane So you can see how they all snap to the grid pretty obviously here. That's something I'd still like to tweak So they don't stay on the grid So you can see we're pathlining a lot of guys and it's not a big speed hit It glitches a little bit when I do it because it is doing them all in the same frame But it's not too terrible Yeah, I don't want you to I know you're joking, but I don't want you to start UV mapping them I mean to start texturing them until the final proportions are decided Uh, which I should probably get an artist to do really instead of trying to just sit here and do it by typing numbers in but What sort of work would be required at a high level to port this game to mac or linux? It's written using sdl Um, and so there is a linux port, but I don't know if it's still up to date it's probably not and The mac issue is going to be the open gl support on the max because I'm using a compatibility context And and also using advanced features and the mac does not have a compatibility context Uh, it has old open gel and new open gel and not a combination of both So I don't know what a good solution to that problem is because I'm pretty freely intermixing them. You pretty much need something like regal or some other way of Supporting the compatibility mode. I think And I don't know anything about regal. I just know it exists. Oh, no, they're all coming to get me huh You know, get me one of them always has their legs forwards so you can't tell that they're Animating at all Is the up-down motion of the feet also ik or curved keyframes? It's neither. It's Not needed. It's a curve. It's following an ellipse. That's it's on the to-do list to fix that to use ik and Move it between the various positions. I mean, it's still ik the the feet. So the feet are never ik the Ik is of the knees. So the foot placement Um is just computed abstractly without any concern for the shape of the skeleton And then the knee is placed to connect the foot to the torso. So Um The positioning of the feet is just pure code. It's this ellipse here This computes a position on a circle and then this computes a position on an ellipse And like I said, I want to fix that. That's on the to-do list The enemy foot from between the two placement positions and the halfway point instead of just having them follow that ellipse Why does it look like I can see the neck through the head? Are some normals flipped? That's a good question I can't see the neck through the head. I guess that was with some of the creatures or something I definitely don't see it from me. Gotta be facing forward when I do that It looks all correct to me There's a little maybe an optical illusion of of the neck showing through But I think it's correct The thing is they're all the same color that all the boxes are the same colors on the sides because they aren't facing the same way Oh the targeting dot. Yeah Yeah, that is the Targeting dot. I should probably turn that off in third person as well Since I added that to the UI I can It's a UI 2d Is that this right here? Seems likely Yep, it's gone now Why is the bottom of the foot not green colored? Am I handling the ambient incorrect? Is the ambient color gray instead of green? I think it is Yeah, that's right. There's a separate color for ambient in the open jail laying system for some reason Makes no sense at all I saw that that's all the questions. So I'm just gonna stop there Uh, and if you get a last-minute question and I'll answer in chat rather than the thing but other than that That is the end for our stream And I will thank you for watching and I will see you next time if you show up Bye. Bye