Using a Line2D node to create physics bodies in Godot

Published: 25 January 2022
on channel: The Shaggy Dev
6,768
214

Let's look at how we can use the Geometry class and the techniques demonstrated in the Polygon2D video to create static and rigid bodies in Godot from Line2D nodes. This is done using the offset_polyline_2d function, which let's us take a line and buffer it by a given amount to create one or more polygons.

Intro: 00:00
Static bodies: 00:30
Rigid bodies: 01:32
Running the sample: 02:42

Godot 3 documentation: https://docs.godotengine.org/en/3.5/c...

Godot 4 documentation (renamed but functions the same): https://docs.godotengine.org/en/stabl...

Polygon2D video:    • Using a Polygon2D node to create phys...  

Source code: https://github.com/theshaggydev/the-s...

Text version: https://shaggydev.com/2022/01/25/line...

Donut Roll (the game showed at the end): https://theshaggydev.itch.io/donut-roll


Watch video Using a Line2D node to create physics bodies in Godot online without registration, duration hours minute second in high quality. This video was added by user The Shaggy Dev 25 January 2022, don't forget to share it with your friends and acquaintances, it has been viewed on our site 6,768 once and liked it 214 people.