0 votes

Hello I made a car with kinematicbody2d. While 2 cars are going to same direction if one car hits other from behind it stops immediately. (the car which hits behind stops). Anyway I can tweak more collision options?

asked Oct 22, 2019 in Engine by Uralkemal (20 points)

1 Answer

0 votes

A KinematicBody2D does not have a "mass" - there are no physics properties in a kinematic body, just movement and collision.

If you want a particular collision response, you have to code it yourself. You could assign a mass and then on collision calculate a resulting force, applying it as an acceleration to the body. All this has to be calculated in your script.

Depending on how complex you want to get with it, it may be easier to use RigidBody2D and let the physics engine take care of things for you.

answered Oct 23, 2019 by kidscancode (13,244 points)

Thank you for your reply! Okay I convert it to RigidBody2D but now there is a new problem. I set_friction to 1(which is max). I still get on friction at all. I made a research and found out i have to set gravity. But problem is my game has top down view. Is there a way to apply friction without turning on gravity?

The 'friction' property is about how the body moves when in contact with other bodies. If you're top-down and talking about friction with the "ground", you want to set the `linear_damp'.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.