Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Player doesn't leave sliding state #416

Open
tfloreste opened this issue May 2, 2021 · 1 comment
Open

Player doesn't leave sliding state #416

tfloreste opened this issue May 2, 2021 · 1 comment
Labels
bug (minor) The game could potentially ship with this bug

Comments

@tfloreste
Copy link

tfloreste commented May 2, 2021

Short description
When jumping in certain rock formations, sometimes the player doesn't finish sliding. When that happens the directional movement becomes unresponsive (jumping sometimes does work to help the player reach the ground, but apparently not always).

It seems to be the same problem described on issue #350
The difference though is that I noticed it happening when the player is not surrounded by rocks (see video below)

Expected behavior
The player finishes sliding and returns to Idle state

To Reproduce
Steps to reproduce the behavior:

  1. Play the "TestingGround" scene
  2. Go to the rock formation at position (-51.1, 0, -14.81)
  3. Jump at it as shown in the video below
  4. Sometimes the player will get stuck and not finish sliding

Notes

  • The video below shows the problem happening. Note that the State Machine doesn't leave the sliding state
SlideBug.mp4
  • Even though I used a specific rock as an example, the problem happened to me in other locations. Including in the Beach location after I built the game

  • This problem doesn't always happen. It seems to be happening quite randomly to me

  • I did a little debugging and the problem seems to be related to high frame rates (SEE EDIT BELOW). In the screenshot of the console below (taken during the video above) we can see that:

    • The first line (SLIDE ACTION VELOCITY: ....) shows the velocity vector calculated in SlideActionSO.cs. It has a negative value in the y component, which seems to be correct. This velocity is the one that is set in the movementValue vector of the Protagonist script and is then used in the ApplyMovementValueSO.cs to apply the movement.

    • The second line (Movement Vector: ...) shows the value of the movementValue vector the ApplyMovementValueSO.cs script uses. It has the same value calculated in the SldeActionSO.cs, which is also correct

    • The third line (deltaTime: ....) shows the Time.deltaTime value used as a multiplier in the ApplyMovementValueSO.cs script

    • The fourth line (Moving towards: ....) shows the resulting product between movementValue and Time.deltaTime. The result has the y component equal to zero, which is not correct (in this case, the expected value should be around -0,0016). I imagine this is happening because the Time.deltaTime is a very small number and the result is rounded to 0

SlideBug

EDIT

After a little research, I found the problem was (probably) not related to frame rates. It seems that printing a Vector3 will automatically round its value but it doesn't mean the "real" value was rounded.

I did more testing and even when the y component of the movementValue vector is not zero the problem still happens (see video below. This time I recorded the console too).

bugSlide2.mp4

I also added code to debug the CollisionFlags returned by the CharacterController.Move method (the same code described in this link). In the image below the "Move towards" vector is not zero, but when that screenshot was taken the player was stuck in the air (second video). Also, it seems the controller is only detecting a collision below the player. Can that collision be preventing the player from falling in this case?

slideBug2

@tfloreste tfloreste changed the title Player doesn't leave sliding state (probably related with high framerates) Player doesn't leave sliding state (probably related to high framerates) May 2, 2021
@tfloreste tfloreste changed the title Player doesn't leave sliding state (probably related to high framerates) Player doesn't leave sliding state May 2, 2021
@ciro-unity ciro-unity added the bug (minor) The game could potentially ship with this bug label May 3, 2021
@ciro-unity
Copy link
Contributor

Thanks @tfloreste. Like all of these "bugs", let's keep it open for a while but at the same time it's not something that worries us too much as long as gameplay is functional, since this is not a platformer game so we're inclined to accept a little degree of these edge cases.

(PS: your Github profile bio is funny)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug (minor) The game could potentially ship with this bug
Projects
None yet
Development

No branches or pull requests

2 participants