Forum rules - please read before posting.

IsJumping is set to False mid jump

edited April 2021 in Technical Q&A

Hello!
I'm quite new to AC so this probably is mistake on my end, so I just want to ask if anybody knows how to solve it.
My problem is that my Parameter - Jump bool is sometimes being set to false in the start of jump. I have suspicion, that it checks if isGrounded is true and it thinks it already landed even though it didn't even start to jump yet. Weird thing is it does it only sometimes. I have been trying to solve this for a few days now. I have seen someone post here similar problem, but he didn't solve it, he remade whole player and it didn't happen again. ( It was here: https://adventurecreator.org/forum/discussion/6639/how-exactly-does-isgrounded-work ). So I added a lot Debug Logs to check what is happening and it seems like it check IsGrounded after the start of Jump to quickly? Not sure. Here is video of my just pressing space to Jump and nothing else:
You can see that the bool in animator "Jump" is uncheck sometimes too early.
I haven't touch scripts to modify it yet, started recently and wanted to set up simple animations and controller.
Here are components screenshots from Main Character:


I don't have problems with how animations look, I know they are wrong because of how the Jump bool and IsGrounded bool is ticking, so when I repair those, it should be ok.
I have added some Debug.Logs, which won't make much sense, but one I will show you is this one:

This should happen after the main char is done with jumping and isGrounded right?
But it happens in exact same second as pressing space bar or as adding force for vertical movement:

I hope you understand what my problem is and maybe I have missed something or set up some variables wrongly, but I wasn't able to figure out what. Thank you for your time and your replies. If you need some information I can add anything that you would find helpful.
Thank you again.

PS: Adding Hierarchy and Scene view and CollisionCube, which it check ground for:

Comments

  • Welcome to the community, @Kiki. Apologies for the trouble.

    Are things more reliable if you uncheck Move with Rigidbody? in the Player's Inspector? It seems that this is an issue with the grounded check.

    You may want to try using a Character Controller instead, which offers a built-in and more reliable means of checking a character's grounded state.

    Jumping with a Character Controller isn't available built-in, but an add-on script for it can be found here: https://adventure-creator.fandom.com/wiki/Jumping_with_a_Character_Controller

    Otherwise, you may need to PM me a .unitypackage of the character's assets and scene - this may be something I need to see for myself to properly understand.

  • Thanks I removed Rigidbody and Capsule Collider and add Character Controller with the script you linked and it is working properly! :smile:

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.