I'm using zylanns height terrain plugin: https://github.com/Zylann/godot_heightmap_plugin
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:

The sphere being moved:

Sphere that's stuck:

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