So I've been playing around with a racing game in which the AI follows a predetermined path3D. I figured out how to create a basic path and get my kinematic body to follow it at one consistent speed, but now I'd like to figure out how to use GDscript to change the speed throughout.
I'd really like to play with each NPC's speed as they travel along the path. It seems like offset or unit offset should be able to achieve this quite easily, but I'm not sure how I'd put that into code or where. I'm assuming under the path follow node? For example, my current path is about 550 units right now. What if I want to change the speed from 5 to 5.5 at 100 units? What if I want to be able to change the speed at every 100 unit variable?
Currently my code is set up under the kinematic body which is the child of a path follow node which is the child of a path node. I got this code from watching the starfoxish youtube tutorial and getting rid of all the gun elements.
extends KinematicBody
var parent
var speed = 5
func _ready():
parent = get\_parent()
func _physics_process(delta):
parent.offset += delta \* speed
Any help would be greatly appreciated!