G’day. I’m making a game for an android where police car chasing your car. I tried to make script for chasing, but it didn’t work. Then i tried to search at youtube
for tutorial, but there’s zero of them.
So please, can u make me a code that gonna work?
Here’s my try:
extends VehicleBody3D
@onready var target = $“.”
const MAX_STEER = 0.8
const ENGINE_POWER = 1250.0
func _physics_process(delta):
engine_force = -ENGINE_POWER
var direction = (target.position - position).normalized()
linear_velocity = direction * ENGINE_POWER
look_at(target.position)