-
-
Notifications
You must be signed in to change notification settings - Fork 21.7k
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
[Bullet] Kinematicbody snap drags objects down even without any velocity #22313
Comments
You think this is a bug? |
Yes. There is no velocity applied to the kinematicbody so it shouldn't move. |
No, kinematicbody doesn't move anywhere if you don't move it. |
Increasing collision safe margin makes it go faster so I think something like this happens: |
Are you seriously suggesting that it would just magically move? |
And I just noticed that stop_on_slope is broken on 3D too and slows down the sliding speed when moving uphill. Yeah it seems like a bug indeed. I'm not claiming anything happens magically but it's clear that the change from |
Ah, it's the snapping force pulling you downhill. Try setting it to a positive value and you'll see that you don't slide at all. |
If you read the current docs, the vector is just a simple vector (no magical powers involved): » Moves the body while keeping it attached to slopes. Similar to move_and_slide(). As long as the snap vector is in contact with the ground, the body will remain attached to the surface. This means you must disable snap in order to jump, for example. You can do this by settingsnap to(0, 0, 0) or by using move_and_slide() instead. « |
Well then the vector is pulling the kinematic body straight down on the Y axis (-1) so I suppose it's working like gravity. The surface is sloped too so the body will slide down. |
If the method description is correct, the vector shouldn't represent a force. It selects the surface to which the body should be attached. How well it has been implemented is another question. It looks as if it only works as intended if the snap vector is in the opposite direction to the collision normal? |
Not in a place to share my project but, Changing from 3.0 to 3.1 has affected my player movement and he will now slide down slopes. This is a slight improvement for me but still not perfect. I will agree that |
I would like to revert stop_on_slope from that function that seems not so good. You can always use the system with ray shape that reduz created https://godotengine.org/article/godot-31-will-get-many-improvements-kinematicbody What do you think about it? |
I love the raycast shape idea but it was already broken (more like unfinished though) even before stop_on_slope. With stop_on_slope enabled the ray shapes behave very diffrently. Multiple rays don't cause errors anymore and they only work when pointing down but they cause some jittery collisiions with the floor. |
Well stop_on_slope isn't fully working for me, but this issue is not about it. |
(I would vote for reverting back to slope_min_velocity and fixing the raycast shapes) |
I think this is more of a bug of stop_on_slope, @AndreaCatania can you give a check to this? |
More like "Raycast shapes kinda work", unless issue #25050 been addressed already. |
The solution to this for now probably would be to not use snap if your character is not actually moving left or right (or use a threshold). I'm not quite sure this is a bug yet, but I plan to rewrite both KinematicBodies (2D and 3D) for 4.0 into a way where these things can be customized more. I will kick to then. |
I've just encountered the exact same problem using the KinematicBody2D node. I was going mad. |
Like @Scemenzo , I've also encountered the issue with KinematicBody2D. Kind of annoying, I thought the whole point of snap was to make working with slopes easier. Even with very gentle slopes and stop_on_slope enabled, the kinematic character will continue to move slowly down the hill. Going to try @reduz 's suggestion to use move_and_slide when not walking. Maybe try zeroing out the motion if it falls below a certain number. |
This is kind of a fundamental problem with margins. Move an object down until it collides, then the margin will push it out along the normal. It's also (physics) framerate dependent. The more frames you have, the more frequently it'll get pushed out. Effectively the same issue as this: |
As @jitspoe suggests, yes, the problem is that they're pushed out in the direction of the surface normal. What would be ideal, I think, would be to optionally specify the calculation of new margin vector based on angle of attack- In other words, separate the objects in the direction of velocity rather than direction of the normal, with that velocity-based separation's length calculated to the point where the objects are separated by a distance equal to the normal-based margin. |
Godot version 534b7ef
Kinematicbody snap drags objects down even without any velocity.
This is 3D, it is just sideview to better illustrate what is happening.

This is the full code in kinematicbody.
Copied here from one of my comments for visibility:
Minimal Project.zip
The text was updated successfully, but these errors were encountered: