Zylann / godot_heightmap_plugin

HeightMap terrain for Godot implemented in GDScript
Other
1.72k stars 159 forks source link

KinematicBody moved with move_and_slide falls through terrain that is not flat #154

Closed matthew798 closed 4 years ago

matthew798 commented 4 years ago

Describe the bug Using a KinematicBody, moved with AnimationTree.get_root_motion_transform.origin fed to move_and_slide causes the KinematicBody to fall through the terrain wherever the angle changes.

That is to say, at the junction where the terrain goes from flat to angled, the kinematic body will fall through the terrain. Flat terrain works as expected.

To Reproduce Open and run this project

In this demo, the character will start walking forward right away, and will quickly fall through the terrain as there is a very slight incline right in front of the character.

Expected behavior The character collides and slides with the terrain collider, remaining above the terrain

Environment

Zylann commented 4 years ago

As fas as I know, the terrain uses a HeightMap collision shape, which is implemented in Bullet inside Godot. There is nothing special the plugin does with it, so I can't really help you. Raycasts work and dropping cube rigidbodies also work. Maybe there is a problem in your code, in Bullet or Godot's Kinematic Body?

matthew798 commented 4 years ago

Hmm, strange...

Ill have to post this on reddit or so.

BTW, just wanted to say a heartfelt thanks for all the work you've put into this tool. This should become the built in standard way of doing terrain in Godot. Absolutely fantastic.

matthew798 commented 4 years ago

I figured it out. It was a lack of knowledge in regards to godot. My root node was a spatial, containing the KinematicBody. I had to make my root node the KinematicBody.