Hello!
I'm trying to develop a game where a character can move in the X, Y, and Z directions based on user input (let's say for sake of argument, there are three axes values and each axes determines the velocity the player should be moving in the X, Y, or Z direction). It is my current understanding that the UltimateCharacterLocomotion only uses a Vector2 for input to determine movement. This would allow me to move in the X and Y direction but not the Z direction.
My initial thinking was that I could create an ability to implement this, but I am running into the following challenge. After looking at the Ability class, my first inclination is:
I'm trying to develop a game where a character can move in the X, Y, and Z directions based on user input (let's say for sake of argument, there are three axes values and each axes determines the velocity the player should be moving in the X, Y, or Z direction). It is my current understanding that the UltimateCharacterLocomotion only uses a Vector2 for input to determine movement. This would allow me to move in the X and Y direction but not the Z direction.
My initial thinking was that I could create an ability to implement this, but I am running into the following challenge. After looking at the Ability class, my first inclination is:
- Override the UpdatePosition() function and use AddForce(...) to apply an incremental external force based on the value of each axes at the current frame minus the value of the axes at the previous frame. However, it's not clear to me that this would work, because in DeflectVerticalCollisions() the Y component of the external force is set to zero if the player collides with another object. So as an example, if the value of Y input axes is 0.4, and that applies an external force of 0.4, then DeflectVerticalCollisions() will set the external force in the Y direction to 0. Then if the player changes the Y input to 0.3, it will decrement the external force by 0.1, resulting in a external force of -0.1, which will move the character down in the Y direction.
- The second approach would be to modify the m_MotorThrottle in my ability, but it seems like the UpdateMotorThrottle() function in CharacterLocomotion.cs would reset any value I set m_MotorThrottle to.