#Question about complex character movement implementation
1 messages · Page 1 of 1 (latest)
I'm trying to design a controller (using CharacterController and InputSystem) based around Vector2 inputs for the WASD and Mouse (delta), but the key is that I want to only loosely couple the camera orientation and the player model orientation. My current goal is to just get a simple controller running where direction control is significantly reduced while airborne/not grounded.
Right now my thought process is that there will be 2 separate headings for the camera and player. The first step would be to calculate the new camera heading/orientation using the mouse delta values, after which if the character is grounded I can simply assign the horizontal plane components to the player heading then move, but if the character is in the air I want to Lerp (I think?) the movement vector towards the new camera heading to limit how much it can change.
Does that sounds correct? Am I getting myself into a bit of a mess with that approach? The next goal is implementation of Tribes-esque skiing, so if that changes the form this mechanism needs to take I'm all ears
Question about complex character movement implementation
I pushed through and ended up implementing this, I'll post the code tomorrow for anyone curious
Here's the solution I came up with, probably some room for efficiency improvements: https://gdl.space/gokehequtu.cpp
i've heard you want to use enums when possible instead of bools to track states (bool shouldJump = this.state == 'should jump') to prevent errors and prevent ambiguity (two conflicting bool states true at the same time, or whatever).