Hey Guys
I am having the following problem: I want to be able to spawn my plane in the air and let it land automatically using the defined path. After I should be able to use the ground commands again and to drive around on the airport area. My problem is now: If the plane is landed through the script, i can move it around but it allways gets pulled back to the Gizmo. I would like it to be released from the path script as soon as i have pressed the “up Arrow once”, but how to set this up?:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PathFollower : MonoBehaviour {
public Transform[] path;
public float speed = 5.0f;
public float reachDist = 1.0f;
public int currentPoint = 0;
void Start(){
}
void Update(){
Vector3 dir = path [currentPoint].position - transform.position;
transform.position += dir * Time.deltaTime * speed;
}
void OnDrawGizmos (){
if (path.Length > 0)
for (int i = 0; i < path.Length; i++) {
if (path *!= null) {*
_ Gizmos.DrawSphere (path .position, reachDist);_
* }*
* }*
* }*
}