+1 vote

How to make ideal circle Path2D in simple way? Manual adjusting Path2D is annoying.

in Engine by (95 points)

What are you trying to accomplish? There may be an easier solution, depending on what you are planning to use the circular path for.

I would like to make space ship movement around planet

1 Answer

+5 votes
Best answer

If all you want is circular movement, this is far easier done by parenting your "ship" to a Node2D and rotating it.

-- Ship

extends Node2D

var speed = 2  # rotation speed (in radians)
var radius = 100  # desired orbit radius
func _ready():
    $Ship.position = Vector2(radius, 0) # desired orbit radius

func _process(delta):
    rotation += speed * delta
by (21,979 points)
selected by

Quite nice and simple solution, but what if I want after press space, spaceship go straight forward in direction that was during space press?

You know the direction (the rotation of the node) so stop the rotation and apply a velocity in that direction. If you have multiple planets you can have them "capture" the ship by changing the ship's parent. It's hard to be much more specific because it really depends on how you're implementing movement and what kind of body you're using for the ship.

Yes you are right, thanks for help! I am new one here, have some experience with game dev, but I was using Corona SDK, Godot development flow is very different still learn!

Thank god, it saves me from the hell of physics

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.