0 votes

In the documentation for KinematicBody2D, it says:

Kinematic bodies are special types of bodies that are meant to be user-controlled.

Which gave me pause when considering how to implement some characters in my game! I currently have a player character scene with a KinematicBody2D root node and was considering having a base "character" scene for all characters to inherit from (including the player character), to handle general path-finding movement (player character movement is primarily point and click right now, where there are several obstacles like counters, etc, to navigate around given a Navigation2D and a corresponding tile map. Actual movement done via moveandslide right now).

The other characters in my game would mostly be customers of the simulated store that would likely path find to a designated waiting area, then leave and path find out once they are given their order by the player character.

With my initial thought of just having the same movement functions for the player and customer characters, the customer characters would inherit from the generic "character" scene and script and have that same KinematicBody2D root node, then further have something like an Area2D child node in order to detect player clicks / interaction (all other interactables have an Area2D base node).

Can someone elaborate more on the documentation and when to use KinematicBody2D? Would this specific use case make sense, or is there a better/simpler way?

asked Jun 5 in Engine by patrice (19 points)

1 Answer

+1 vote
Best answer

When it says "user-controlled" it's talking about the programmer, not the player of the game.

Kinematic bodies are controlled by code you write. They do not move unless moved with one of the movement methods. This is in contrast to rigid bodies, which are controlled directly by the physics engine, which calculates their movement.

Your idea is perfectly reasonable. The only difference between the player and the customers is what determines their desired movement direction: input (for the player) or nav (for the customers).

answered Jun 5 by kidscancode (17,168 points)
selected Jun 5 by patrice

Thanks so much for the quick answer! That helps a ton and gets me over my mental block. (also love your content! I've gone through a fair number of recipes and YouTube videos of yours :D)

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.