#Rotate a moving player around a point

1 messages · Page 1 of 1 (latest)

limpid breach
#

Hello, ive got a top down project i'm working on at the moment. I've got my player contorler and when its on a disc (CollisionShape), i want the player to spin with the disc but still be able to move normally. I can't figure it out and wondered if anyone had a suggestion?

[Video of character controller and this disc is where the roundabout is]

#

extends Area2D

@onready var centre = $"../Centre"
@onready var car = $"../Centre/Car"

var rotate = true
#var angle = 0

func _on_body_entered(body : CharacterBody2D):
rotate = true

func _on_body_exited(body : CharacterBody2D):
rotate = false

func _process(delta):
if rotate:
centre.rotate(0.01)
else:
car.top_level = true
centre.rotation = 0
car.top_level = false