Implement circular motion

Godot Version 4.2.1

How do I implement circular motion

I have tried to implement circular motion like this


@tool
extends MeshInstance3D

var radius = 10
var velocity: Vector3

func _ready():
    transform.origin = Vector3(radius, 0, 0)
    rotation = Vector3.ZERO
    velocity = Vector3(0, 0.5, 0)


func _physics_process(delta):
    var acc = -transform.origin.normalized() * velocity.length_squared() / radius
    velocity += acc * delta
    translate(velocity * delta)


I also want to face my object as direction of velocity. So I tried to use look_at() but I can’t get it to work. And when I tried it error popping constantly on console saying

server/rendering/render_scene_cull.cpp:922 - Condition “!v.is_finite()” is true

I can’t get rid of that removing look_at() even commenting out whole script. Only way is deleting the object (MeshInstance3D). So I have to setup that object again. Please help me with this. Thank you.

This looks strange. Perhaps you wanted to use Vector3?

I am sorry that is a typo. But in code I used Vector3