Help with trembling kinematic body

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

Hi all

Hope someone can help me. I have a kinematic body that I want to move along a path. I can do it when it does not have a collision shape but as soon as I add a collision shape, it stays in the same place and trembles rather than moving. I am probably making a stupid mistake somewhere. I also asked in r/godot but didn’t get help. I will include some images and gifs to show what I mean by trembling!! It is fun watching but not what can use as an NPC behaviour.

Any help greatly appreciated.

Code below.

extends KinematicBody

var path = []
var pathind=0
const move_speed = 2
var dstat=0
var mtgt=null
var dirx=Vector3.ZERO

func _process(delta):
	if not mtgt and "chores" in get_parent():
		var rnum=int(rand_range(0,get_parent().chores.size()))
		path=global.masternav.get_simple_path(global_transform.origin, mtgt.global_transform.origin,true)
		print(path, "to ",mtgt)


func _follow_path():
	if pathind<path.size():
		if dirx.length()<0.5:

func _turn_towards(pos):
	var ldir=pos
	look_at(ldir, Vector3(0,1,0))
:bust_in_silhouette: Reply From: TeaCrab131

Your kinematic body is probably already colliding with something as soon as you start the game. Check the spawn position, move the spawn point away from possible collisions and see what happens.

Sorry for the delay - life got in the way of coding!

You were absolutely right, the collision shape for the floor was too high. I feel so dumb right now!!

Thanks for the hint.

sxkod | 2022-08-24 15:49