![]() ![]() It's a particular class only that's exhibiting this behavior. I have other kinematic bodies in my project that it's not happening to. The strangest thing of this all is that it's not happening with all objects. Move_and_slide() moves the kinematic body in the opposite direction than it's supposed to Move_and_slide() causes a kinematic body to slide(no incline) when called with Vector3.zero Thanks to ClumsyDog for his answer that led me to start from scratch and isolate the problem.I'm having a very strange problem in 3.5 stable, Ive been working on my project for months but this just started happening a few days ago. ![]() Velocity.y = move_toward(velocity.y, floorNormal.x * MAX_SPEED * inputVector.x, FLOOR_ACCELERATION * delta) SlopeAccelerationFactor = floorNormal.x * sign(floorNormal.x) * 2 If floorNormal.x * sign(floorNormal.x) >= 0.5: So what I did was set it to be what I want it to be by hand, that is, floorNormal = get_floor_normal() First of all, I can confirm that my analysis as for the cause of the issue was correct, in that the velocity.y decreases according to gravity from its initial value after the ascending phase to zero, even though it appears to be constantly zero on the tip of the mountain. If I make the tip wide enough for the correct collision to be detected before the player reaches its end, the issue is not visible.Įdit 2: for whomever might need this, I found a solution. Thank you so much in advance, this is really driving me crazy!Įdit: I also found out that no collision with the floor is detected for a short period of time after the player climbs the slope and proceeds to snap to its horizontal tip. Of course if it can help I can post the whole code. Lastly I apply gravity in the straightforward way on a different class from which the player inherits. Also the state is always ON_FLOOR until the player jumps, so I don't think there's something weird happening there either. I've already tested that the issue remains if I remove the part where I add the normal.y of the slope to the velocity.y. ![]() Velocity.x = move_toward(velocity.x, inputVector.x * MAX_SPEED, FLOOR_ACCELERATION * delta) Velocity.y += get_slide_collision(0).normal.y * 32 SnapVector = -get_slide_collision(0).normal * 32 InputVector.y = Input.get_action_strength("ui_down") - Input.get_action_strength("ui_up") InputVector.x = Input.get_action_strength("ui_right") - Input.get_action_strength("ui_left") Velocity = move_and_slide_with_snap(velocity, snapVector, Vector2.UP, true, 4, 1.22) Here's the relevant part of my code: func _physics_process(delta): Whether I'm right or not concerning the cause of the issue, I would really appreciate it if you could give me some advice on how to solve it. What I observe, however, is that it does a little jump when it reaches the edge, and the steeper the cliff the higher the jump, as if it kept the momentum from the ascending phase and released it when the snapping stops. I'm using the function move andslide withsnap for movement, which works fine in most cases, but I've noticed something weird: when the player runs up a steep cliff which is also steep on the other side but has a sufficiently narrow horizontal tip, my understanding is that it's supposed to keep sliding down smoothly after passing the edge of the tip, or at least detach itself from the ground and fall. Hello, I just started using Godot with my first attempt at a simple platformer. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |