lohalifestyle.blogg.se

Godot kinematicbody2d
Godot kinematicbody2d









godot kinematicbody2d

We start by creating a KinematicBody2D node. Place a few ground tiles and we are ready to begin creating our player controller.

#GODOT KINEMATICBODY2D HOW TO#

If you do not know how to create your own TileSet, you can watch from 4:14 in one of my previous videos. The scene tree for the tile set used to create ground for the player to stand on may look something like this:įor the sake of this tutorial, I am assuming you are familiar enough with Godot Engine and know how to setup and convert your own TileSet to load it up on the TileMap. The way I setup my tiles is by having a Sprite as the main node for each tile, a StaticBody2D as the "body" for the tile, and inside the body, a CollisionShape2D or CollisionPolygon2D. In order for the player to stand on any ground, we will need to setup a TileMap that uses appropriate collision blocks. Today I will demonstrate how to create a simple player controller with KinematicBody2D. I would also be so bold to claim that setting up a player controller for KinematicBody2D is much easier than setting one up for RigidBody2D. With KinematicBody2D you manually create the "laws of physics" for when you need them. Selecting a RigidBody2D will also give you additional properties that you can change, such as mass, weight, friction, gravity scale and so on. An example might be if you wanted to create a ragdoll that have movable parts upon death, or if you simply want your player to directly interact with other physics objects around you, such as moving rocks that you can "push" by moving towards them.

godot kinematicbody2d

RigidBody2D is used when you want to interact with other objects affected by physics. You can download the Source Code from my video tutorial here.Ī few differences between RigidBody2D and KinematicBody2D The Player Controller with KinematicBody2D is a simple demonstration of how you can implement your own player in a platformer-style game.











Godot kinematicbody2d