Right now, crouching makes you swim downward and toggle crouch at the same time if you are swimming, it does this each and every time you press crouch. How do you want this ambiguity dealt with?
should the player not be allowed to crouch when swimming, and automatically stand if entering dungeon water?
Should the player only toggle crouch if the player is already on the ground while swimming, and be disallowed from crouching if not grounded and swimming?
Crouch ambiguity when swimming.
- Interkarma
- Posts: 7247
- Joined: Sun Mar 22, 2015 1:51 am
Re: Crouch ambiguity when swimming.
I lean more towards this option. I'm also interested in feedback from others if anyone sees an issue with this.MeteoricDragon wrote: ↑Tue Aug 21, 2018 12:27 am should the player not be allowed to crouch when swimming, and automatically stand if entering dungeon water?
- MeteoricDragon
- Posts: 141
- Joined: Mon Feb 12, 2018 8:23 pm
Re: Crouch ambiguity when swimming.
In my PR. Allofich said there's a spot that requires crouching in castle wayrest. So... I guess that answers my question.
- MeteoricDragon
- Posts: 141
- Joined: Mon Feb 12, 2018 8:23 pm
Re: Crouch ambiguity when swimming.
When the player is touching the ground when swimming, the grounded variable isn't true, how curious...
- Interkarma
- Posts: 7247
- Joined: Sun Mar 22, 2015 1:51 am
Re: Crouch ambiguity when swimming.
I believe this is a limitation of the character motor in Unity. It can also be an issue when levitating over a moving platform, the platform will simply pass through player. I don't have a good solution for this at this time.
Maybe best answer for now is just to allow crouch toggle in water and add this as a bug for later review. Alternatively we could decouple crouch from "float down" input so crouch is just crouch..
Maybe best answer for now is just to allow crouch toggle in water and add this as a bug for later review. Alternatively we could decouple crouch from "float down" input so crouch is just crouch..
- MeteoricDragon
- Posts: 141
- Joined: Mon Feb 12, 2018 8:23 pm
Re: Crouch ambiguity when swimming.
I think i just figured out a solution. I'm going to go test it. I check the collision flags on levitateMotor in the heightchanger class on whether the player can toggle crouch or not.Interkarma wrote: ↑Tue Aug 21, 2018 9:21 pm I believe this is a limitation of the character motor in Unity. It can also be an issue when levitating over a moving platform, the platform will simply pass through player. I don't have a good solution for this at this time.
Maybe best answer for now is just to allow crouch toggle in water and add this as a bug for later review. Alternatively we could decouple crouch from "float down" input so crouch is just crouch..
Code: Select all
else if (!playerMotor.IsRiding && !onWater &&
(!levitateMotor.IsSwimming || !levitateMotor.IsLevitating || levitateMotor.CollisionFlags == CollisionFlags.Below))
{
// Toggle crouching
if (InputManager.Instance.ActionComplete(InputManager.Actions.Crouch))
{
if (playerMotor.IsCrouching)
heightAction = HeightChangeAction.DoStanding;
else
heightAction = HeightChangeAction.DoCrouching;
}
}
- MeteoricDragon
- Posts: 141
- Joined: Mon Feb 12, 2018 8:23 pm
Re: Crouch ambiguity when swimming.
The code i posted above didn't work, and I think I have another solution. Involves testing to see if the player has changed YPosition after pressing crouch to descend. If no descent, and is swimming, crouch.