Putting my movement theory to use

the last couple days I have been working on this movement code and It’s about to break a ball. I have officially hit a rough patch and I’m not too happy with it. Basically the idea is that the code I’m writing is going to replace the movement code that is already in HL2, adding the functionality that I want:

Compile time creation of new stances
Ability to add stances dynamically
Simple Management of stances
Dynamic movement between them

Well I hit a hump a couple days ago after I finished the code related to transition. If you want to see what happened, please check this out…


I realize it is low quality but the gist of my issue is there. The narrative is – I have the ability to go from standing to crouch and then to prone without any issues, but as soon as I die I lose my smooth transition. Another symptom of this is the calculations, this is where things start getting a little weird. The eye is being moved with a function, adapted from SetDuckEyeOffset(), called SetEyeOffset. The way it works is identical to how set duck eye offset works, but it gets the destination and previous stances in order to know where a) it need s to go and b, where it was. Once the player dies the transitions are no longer smooth and the number of calculations doubles. The weird part in there is that the transitions double and begin to overlap each other. The player is still able to move between the stances, and their eye ends in the right location, but if they want smooth transitions they are out of luck. There is more going on here though, for instance the eyes move up and down, bouncing small amounts, not between the two stances, but between where it is and a small amount above or below it, which eventually subsides in a gradual fashion.

Hold on I just thought of something…

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.