Character Body wont move +Y whilst in Area3D

Godot Version



Hello, I am currently attempting to use Area3Ds to denote bodies of water. I am using an Area3D + CollisionShape3D in the world to detect an Area3D + CollisionShape3D attached to my character. Using signals all detection worked well, but oddly my character would refuse to move vertically. I tested in and out of my area setups with the same code and the body simply refused to move up, but would move in every other direction. I also ran a print command on my vertical move code, which was simply “input → velocity.y” and the code was running. I am very new so hopefully this is just beginner error…

Is the character hitting something? if you’re using move_and_slide it should return true if you collided with something.

Will double check, but the “water area” is in open space to the side of my beginning platform. There is a mesh plane but that has no collision… Once again testing.
Also thanks!

Tried and unclear. Not familiar with how to get move_slide to return a console message (I assume that is what you meant), how would I do so?
As well, removed all but the water areas and player, still had the issue.

Got move_slide to return message, test comes back negative. No physical collision only signal fires…

And you can move up outside of the water area?

Jumping using velocity works just fine.

Hold on, may have found problem… Edit: Nope…

Ok, no idea why, but it started working… Kinda… Brutalized my code to eliminate any potential contradictions, so its not running smooth, but I think I’ve isolated the issue. My vertical control block was basically…
If → Input
If → Input
I think the code didn’t like that, I removed the second if and else and it started responding…
So moral of the story is… Uh, code better lol.
I should have known such a simple setup would cause errors in hindsight.
Gonna put my stuff back together before finalizing this topic just in case though.

ah yeah, you probably just needed

if up_input:
elif down_input:

But also check out Input.get_axis() and Input.get_vector() those make simple movement code even simpler

1 Like

That makes sense, thanks for the closing tip. Id say that is probably the solution to this mess. Thanks!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.