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

Fix typo that may cause crouch to always be true #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CharacterController2D.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ private void FixedUpdate()
public void Move(float move, bool crouch, bool jump)
{
// If crouching, check to see if the character can stand up
if (!crouch)
if (crouch)
Copy link

@ertanturan ertanturan Jan 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The soultion brings a good fix . Accepting pull req. would solve the issue ...

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had a similar solution. @ATBrackeys this is a bug and should be addressed.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like it was intended to check when the Parameter for crouch was false (the user/player stop holding the crouch input button) so then it could check if the PlayerObject could "stand up"

Still learning unity but adding something below as well as setting k_CeilingRadius to a lower float fixed my problem

Suggested change
if (crouch)
if (m_wasCrouching && !crouch)

{
// If the character has a ceiling preventing them from standing up, keep them crouching
if (Physics2D.OverlapCircle(m_CeilingCheck.position, k_CeilingRadius, m_WhatIsGround))
Expand Down