Platformer Kinematic collisions stutter / jiterring

Hi guys,

I’m a newbie with Defold and starting a prototype with Platformer game first. I’m having a problem that can’t understand how Defold works.

  1. I’m following Resolving kinematic collsions in Defold
  2. My result: Character sometimes be stutter / jitter from ground, pls help ref below video

Character’s delta position and message normal information logged as below:

DEBUG:SCRIPT: @ delta position	vmath.vector3(0, -0.11111111938953, 0)
DEBUG:SCRIPT: @message normal	vmath.vector3(0, 1, 0)
DEBUG:SCRIPT: @ delta position	vmath.vector3(0, -0.11111111938953, 0)
DEBUG:SCRIPT: @message normal	vmath.vector3(0, 1, 0)
DEBUG:SCRIPT: @ delta position	vmath.vector3(0, -0.11111111938953, 0)
DEBUG:SCRIPT: @ delta position	vmath.vector3(0, -0.33333334326744, 0)
DEBUG:SCRIPT: @message normal	vmath.vector3(0, 1, 0)
DEBUG:SCRIPT: @ delta position	vmath.vector3(0, -0.11111111938953, 0)
DEBUG:SCRIPT: @message normal	vmath.vector3(0, 1, 0)

The frame has vmath.vector3(0, -0.33333334326744, 0) is the cause of this stutter but I don’t know how to sync message handler into the update frame logic before rendering.

One more weird: If I moving my Character ( along x axis ) then the stutter disappear. vmath.vector3(0, -0.33333334326744, 0) never logged.

Could anyone help explain this weird behavior? thanks.

I suggest that you compare your code with this sample platformer game:

Thanks @britzl , I try to adapt your player.script to my hero.script but this issue still appear. Here is my code for testing your sample.
Cratebox-defold.zip (324.4 KB)

Could you help take a look and figure out what i’m doing wrong here? thanks.

I’ve tried your project and there is indeed a bit of jitter on the player character when having ground contact. It seems like the player is separated slightly too much and for a frame or so has no ground contact. It works much better when I change from a sphere to a box shape for the player.

Oh. It’s a bit tricky. Thanks @britzl , it works now.

There is another problem if I change to use the box shape, the collision message normal is wrong when I hit to wall.

It should be (1, 0, 0) instead of (0, 1, 0) when I pressed A key.

Cratebox-defold.zip (322.2 KB)