GreatGrandmaGames / GrandmaAssetPackages

Asset Packages for a Variety of Unity Gameplay Systems
0 stars 1 forks source link

MOVEABLE Input Bug #5

Closed cmr624 closed 5 years ago

cmr624 commented 5 years ago

Since the Moveable class' .Move() function is called in a MoveController, it is called in a FixedUpdate because it is applying physics changes. We are also calculating the input vector during this fixedupdate, which is fine for an axis that directly apply forces to the RB but not for direct input polls like buttons being pressed down, this has led to some input loss.

elliot-winch commented 5 years ago

try using Input.GetKeyDown(KeyCode.LeftControl) at any time - ie inside InputVectorCalculation

cmr624 commented 5 years ago

That doesn’t work if it’s in FixedUpdate, it should only be in Update bc fixed update is called every physics tick, no? And we want every frame bc the system could miss the input

cmr624 commented 5 years ago

Yeah we use GetButtonDown for jump

elliot-winch commented 5 years ago

Wasn't aware of this limitation. Let me make the following changes to rectify:

Moveable: active.InputVectorCalculation in called in Update, which sets a private Vector3 in the MoveController class

MoveController: uses most recent inoput vector for calculations

cmr624 commented 5 years ago

It’s weird tho, bc I looked it up and modifying the RB directly via input you want in FixedUpdate, but “event-like” polling (GetKeyDown) should be done in Update. If you want we can discuss tmrw / when we meet

cmr624 commented 5 years ago

Going to solve this by writing an Input class

elliot-winch commented 5 years ago

Discussed. Resolved by careful design, rather than developmental base.

cmr624 commented 5 years ago

we should just take "jump" out of movement and add it as an ability. movement should be strictly how a player moves at all times when the component is active

elliot-winch commented 5 years ago

Much smort. That’s a good idea I like it

Sent from my iPhone

On Feb 16, 2019, at 11:02 AM, Carlos Michael Rodriguez notifications@github.com wrote:

we should just take "jump" out of movement and add it as an ability. movement should be strictly how a player moves at all times when the component is active

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or mute the thread.

cmr624 commented 5 years ago

fixed by making jump an ability, gives us more flexibility and separates from the movement system.