In this version of the game version four, you can see that Yeah, the character actually conforms to the environment. And if you run into things, it stops. achieve that. Here's the model. And you can see it's quite complicated. It has 34,000 polygons, 34,000 points and nearly 33,000 polygons.
What we do is we create a simplified version of it. So you can see all we've done there is create boxes share box shapes that match our geometry. simplified version versions of the geometry is going to be used by the ray caster. You can see the outline of them the and they, we give that the name environment proxy so that we can find it in the SPX file that we've exported. And one or two other items in there. Namely, adore proxy adore itself Various funds are ready to rotate.
So yes, the simplified version of the geometry is the way to go for you ray casting so that we can conform to the environment. We have a look at the code for that. And looking at version four of the code. And if we look at our move player, then we use the environment proxy that we found when we loaded in and we're doing exactly the same thing as we were doing with the simple simple yellow boxes. Only we're also casting down because we also need to allow it to go up and down. We can ask From about two meters above both our Y position, our Y position is at our feet.
So in other words, it's just above our head. And we're casting on the environment proxy. Did we find an intersection, we need to know where that is, whether or not it's above or below the place current position. If it's above that, if it's above the place current position, we blend up to that point by adapting our y value to be 80% of current position, and 20% of the target y and we set our velocity which we're going to use for when she's dropping to zero in the target y is below our feet. She must be falling. If we haven't set a velocity for the y value, then we initialize it to zero.
And then we add whatever our delta time is times gravity and increase our velocity by that amount. And then we subtract that value from our Y position. And if it's gone under our target, then we set our velocity to zero. And we set our position y to where the target is, so it conforms to that point. And then we have the ability to run and fall