MindVisceral / EZGame

1 stars 0 forks source link

HeadBob and WeaponBob code is flawed and unintuitive #20

Closed MindVisceral closed 8 months ago

MindVisceral commented 10 months ago

Every frame, bobbing_node's new_position and new_rotation are reset to original_position and original_rotation, only then are new_position and new_rotation calculated, and applied to the bobbing_node

So, bobbingnode's movement is illusory, and this way we're only teleporting it between original and new_ position/rotation This seems like a bad practise, and since this code is reused in the WeaponBob script, it severly inhibits our ability to add weapon bobbing while walking, jumping, falling, and so on, as per issue #9 , #18 , and maybe even #16 .

Solution: Rewrite this piece of code to move the bobbing_node incrimentally every frame, until the desired distance from original_position is reached. From that point, proceed as https://github.com/Papiezator/EZGame/issues/9#issuecomment-1848964675 says.

MindVisceral commented 9 months ago

As mentioned in https://github.com/Papiezator/EZGame/issues/9#issuecomment-1858502834 , this issue has been addressed.

Now this piece of code is based on lerp()-ing between positions. For more information check the comment linked above.

I believe the code has been rewritten sufficiently enough to not cause any further problems.

MindVisceral commented 9 months ago

This piece of code has been tweaked to work with Tweens instead of lerp() now!

Also, I am reopening this issue, because this has not been adressed in the HeadBob script yet.

MindVisceral commented 8 months ago

On 2024.1.11 Headbob script has been rewritten to work just like WeaponBob script; the same goes for tilting too.