I added legs to Rust last week. We’ve always wanted to do it but it’s always had a barrier. A couple of weeks ago I realised that barrier didn’t exist..
We have a skeleton with the player model on it (which is what casts the localplayer shadow). We want to show it, but we also want to manipulate the bones in a way that they don’t conflict with the player’s view.
But if we do that the shadow would be all fucked. We could shrink the top of the spine bone to 0,0,0, but the shadow would be fucked. This can’t work.
But then we were talking and I realised.. why don’t we just render a different model. Then we could do whatever we wanted. I can’t figure out why it took 6 years to think past that limitation.
So what we do is basically copy the third person model (which creates the shadows) and manipulate the bones. The manipulation isn’t anything complicated, it’s just a case of tucking shit behind the camera.
Here you can see how the upper torso is tucked behind the camera.
There’s a couple of extra things we have to do. When you’re crouched and look down, we pull the viewmodel back so it doesn’t clip through your knees.
We also pull the view upwards a bit when you’re crouching and looking down so you don’t put your knee through your head.
It’s possible to show the arms too, but they look ridiculous