I'm trying to make the Third Person Controller character hang from the top surface of a wall and then pull up on top of the wall. The hang should start after a standing or running jump.
When I test it using a running jump, Hang starts, and then the HangState changes to Shimmy, but after that, the character never pulls up. The character either dops a little and remains about 0.5m below the top of the wall (in mid-air but touching the wall), while it continues to play the Hang animation. Alternatively, sometimes the character drops to the ground and runs against the wall.
The Animator Monitor Debug Log is (AbilityIndexParameter for Hang = 104):
774 Changed AbilityIndex to 104 on GameObject
774 Changed AbilityIntData to 2 on GameObject
777 Execute OnAnimatorHangStartInPosition on GameObject
781 Execute OnAnimatorHangStartInPosition on GameObject
783 Execute OnAnimatorHangStartInPosition on GameObject
I stepped through code and, although I might be wrong about his, it seemed to me that the Vertical Velocity should be reset to zero for the PullUp to start. So, since OnAnimatorHangStartInPosition is triggered (3 times for some reason), I subscribed to this event in the Awake() inside my custom PlayerInput, and reset both horizontal and vertical axis values to zero:
private void OnHangStartInPosition()
{
verticalAxisValue = 0f;
horizontalAxisValue = 0f;
}
These values are then used and returned inside GetAxisRawInternal.
However, for some reason, OnHangStartInPosition() doesn't get called while the character is stuck hanging in the wall, even though the subscription inside Awake() runs properly.
EDIT: I solved the problem of the OnHangStartInPosition() handler not running. Initially, I thought that since the handler is independent of the Character, I could treat it as a global event, and not reference any GameObject. Apparently, whether an event can be handled globally or on a specific GameObject depends on whether it executes with a specific GameObjectReference or not (I think ). Anyway, I noticed the debug statements saying that the event executes on GameObject. So, I added the relative reference, and the character pulls up after I use the controls to move it forward ?. I'm very happy to have fixed this on my own!
However, the problem remains that since the character drops down about 0.5m from the top of the wall, and then it starts hanging. So, the pull-up occurs through the wall, and then the character falls, apparently since there's no collider to support it.
Even if add a higher jump force, the character always drops down about 0.5m from the top of the wall. Is there a way to fix this?
I've been trying to solve this on my own for a few days, but now I'm really stuck.
I'd really appreciate your help!
When I test it using a running jump, Hang starts, and then the HangState changes to Shimmy, but after that, the character never pulls up. The character either dops a little and remains about 0.5m below the top of the wall (in mid-air but touching the wall), while it continues to play the Hang animation. Alternatively, sometimes the character drops to the ground and runs against the wall.
The Animator Monitor Debug Log is (AbilityIndexParameter for Hang = 104):
774 Changed AbilityIndex to 104 on GameObject
774 Changed AbilityIntData to 2 on GameObject
777 Execute OnAnimatorHangStartInPosition on GameObject
781 Execute OnAnimatorHangStartInPosition on GameObject
783 Execute OnAnimatorHangStartInPosition on GameObject
I stepped through code and, although I might be wrong about his, it seemed to me that the Vertical Velocity should be reset to zero for the PullUp to start. So, since OnAnimatorHangStartInPosition is triggered (3 times for some reason), I subscribed to this event in the Awake() inside my custom PlayerInput, and reset both horizontal and vertical axis values to zero:
private void OnHangStartInPosition()
{
verticalAxisValue = 0f;
horizontalAxisValue = 0f;
}
These values are then used and returned inside GetAxisRawInternal.
However, for some reason, OnHangStartInPosition() doesn't get called while the character is stuck hanging in the wall, even though the subscription inside Awake() runs properly.
EDIT: I solved the problem of the OnHangStartInPosition() handler not running. Initially, I thought that since the handler is independent of the Character, I could treat it as a global event, and not reference any GameObject. Apparently, whether an event can be handled globally or on a specific GameObject depends on whether it executes with a specific GameObjectReference or not (I think ). Anyway, I noticed the debug statements saying that the event executes on GameObject. So, I added the relative reference, and the character pulls up after I use the controls to move it forward ?. I'm very happy to have fixed this on my own!
However, the problem remains that since the character drops down about 0.5m from the top of the wall, and then it starts hanging. So, the pull-up occurs through the wall, and then the character falls, apparently since there's no collider to support it.
Even if add a higher jump force, the character always drops down about 0.5m from the top of the wall. Is there a way to fix this?
I've been trying to solve this on my own for a few days, but now I'm really stuck.
I'd really appreciate your help!
Last edited: