Reply From: | kidscancode |
If all you want is circular movement, this is far easier done by parenting your “ship” to a Node2D and rotating it.
Node2D
– 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
Quite nice and simple solution, but what if I want after press space, spaceship go straight forward in direction that was during space press?
wojtasss | 2018-10-04 17:18
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.
kidscancode | 2018-10-04 19:03
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!
wojtasss | 2018-10-04 19:32
Thank god, it saves me from the hell of physics
dethland | 2020-11-27 15:12