How to get the impact force of the player(kinematic2D) on the floor(TileMap)

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

I want to have the force or last velocity that the player hit the ground, so if the fall is higher, the impact is bigger.
My objective is apply a camera shake (already set up) based on the impact force, and maybe some animations

:bust_in_silhouette: Reply From: kidscancode

A kinematic body’s velocity is set by you, so when you detect a collision with the TileMap, check what your body’s velocity variable is.

I tried with area2d, for example, when body enters: print (motion.y)
sometimes it prints 0, sometimes a velocity, so i think this is not the better way to do it, or i’m doing it wrong

BrunoFreezee | 2020-06-20 20:01

Well, an Area2D should have nothing to do with it at all. When your kinematic body collides, it will report the collision.

I suggest reading this: Using KinematicBody2D — Godot Engine (3.2) documentation in English

kidscancode | 2020-06-20 20:12