0 votes

What is a simple way to get an Area2D to follow the course of a Line2D?

in Engine by (125 points)

2 Answers

0 votes

What do you mean by follow a line?
If you mean it should move like a vehicle on a road, that is what paths are for. The Godot step by steps touches on this.

If you want to make a complex shape like a Z then you need to use more than one collision box.
The reason is that the 3 Area2D objects will resolve collisions faster than a polygon shaped as a Z. In games lots of collision shapes are mixed to create a rough form; to save on math calculations.

If you want a very long collision box then splitting it into smaller ones is also better. A path that spawns the colliders would work for this.

Can you elaborate on what you are trying.

by (1,488 points)

I want to draw a line with a Line2D, and have a node follow the path of that Line2D

0 votes
by (192 points)
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 Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.