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

move_and_slide_with_snap 3D KinematicBody not snapping on slopes #38564

Closed
jesperkallunki opened this issue May 8, 2020 · 5 comments
Closed
Labels

Comments

@jesperkallunki
Copy link

Godot_v3.2.2-beta1_win64

I can't seem to get KinematicBody 3D snap onto slopes. Currently testing with 45º slope.

Same issue here but 2D #26274

I tried the suggestion to set floor_max_angle to 45º or above.

What am I missing here?

Project attached.

Cortez.zip

@Calinou
Copy link
Member

Calinou commented May 8, 2020

Related to #30777?

@madmiraal
Copy link
Contributor

Duplicate of #34098?

In addition I've noticed:

  1. You're turning snap off when not jumping or falling:
	var snap = Vector3()
	if not (jumping or falling):
		snap = Vector3(0, -1, 0)

but you're defining falling as moving down:

	falling = false
	if velocity.y < 0:
		falling = true

which is the case when you're moving down the slope.

  1. You're setting the move_and_slide_with_snap() floor_max_angle to 46° with the slope of your "Mountain" also at 46°. Although this has been fixed with Normalise p_up_direction vector in move_and_slide() #36079, to make this work at the moment requires the floor_max_angle to be greater than the floor.

@jesperkallunki
Copy link
Author

jesperkallunki commented May 8, 2020

The mountain is 45°. After removing falling from snap check

var snap = Vector3()
if not jumping:
	snap = Vector3(0, -1, 0)

and setting max_floor_angle to 90° (just to be sure) it still doesn't snap.

Then I swapped the 4 RayShapes which were the "feet" colliders with 1 BoxShape and with that it indeed snaps to the slope. At first I had the "feet" as a BoxShape but swapped to RayShapes because I don't want the player to slide on slopes but found this #34117. Now snap works but sliding is happening again (I'll try the fix for that from that thread).

So isn't this a bug with RayShape not snapping just like madmiraal linked #34098?

@AttackButton
Copy link
Contributor

AttackButton commented May 21, 2020

Why not set 46º as the default value instead of 45º? Oh, I found out that there is an open one to this.

@madmiraal
Copy link
Contributor

Closing as duplicate of #34098.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants