Unable to move sphere on terrain

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Kiraged

I’m using zylanns height terrain plugin: GitHub - Zylann/godot_heightmap_plugin: HeightMap terrain for Godot implemented in GDScript

I tried moving on a simple square (staticbody, meshinstance, collisionshape) with a sphere (kineticbody, meshinstance, collisionshape) and that worked fine but once I try the same thing on a HTerrain it just doesn’t work. The sphere does not move on the terrain. Do I need to change the collision layers or mask or anything?

The code I’m using to move the sphere:

extends KinematicBody

const gravity = -9.8
var velocity = Vector3()

const SPEED = 6
const ACCELERATION = 3
const DE_ACCELERATION = 5

var camera

func _ready():
  camera = get_node("Camera").get_global_transform()

func _physics_process(delta):
  var dir = Vector3()

if(Input.is_action_pressed("ui_up")):
	dir += -camera.basis[2]

if(Input.is_action_pressed("ui_down")):
	dir += camera.basis[2]

if(Input.is_action_pressed("ui_left")):
	dir += -camera.basis[0]

if(Input.is_action_pressed("ui_right")):
	dir += camera.basis[0]

dir.y = 0
dir = dir.normalized()

velocity.y += delta * gravity

var hv = velocity
hv.y = 0

var new_pos = dir * SPEED
var accel = DE_ACCELERATION

if (dir.dot(hv) > 0):
	accel = ACCELERATION

hv = hv.linear_interpolate(new_pos, accel * delta)

velocity.x = hv.x
velocity.z = hv.z
velocity = move_and_slide(velocity, Vector3(0,1,0))

The scene being played:
scene

The sphere being moved:
player

Sphere that’s stuck:
stuck player

I’m using the latest godot version (3.2.2) and downloaded the addon from the master branch.

Try playing with the collision of the sphere, increase its collision margin. Make a new one just in case. Don’t scale it, resize it with the round handles.

bloqm | 2021-05-13 15:21

Thank you for trying to help, but it has been solved already. Unable to move on terrain · Issue #217 · Zylann/godot_heightmap_plugin · GitHub

Kiraged | 2021-05-13 16:30

:bust_in_silhouette: Reply From: Kiraged

The issue has been solved, Unable to move on terrain · Issue #217 · Zylann/godot_heightmap_plugin · GitHub