3

Sorry, but that's not going to work. ScriptableObjects are supposed to act as assets which can be reused between scenes. That means you can't and shouldn't make them dependent on objects which exist in only one scene. But what you can do instead is: Ugly workaround 1: Have the ScriptableObject find its object(s) at runtime. You can do that by tag, by name ...


1

Your test if(waypoints.Length >= currentWp) is backwards. You want if(currentWp >= waypoints.Length) (ie. "Bail out if we've already reached the last waypoint")


1

Hope this helps public float speed; public float turnSpeed; public Transform player; public Transform[] waypoints; private int currentlyActive = 0; void FixedUpdate () { if(waypoints.Length >= currentlyActive) { return; } waypoint = waypoints[currentlyActive]; player.position = Vector3.MoveTowards(player.position, waypoint....


1

(1) Refer to the idea of an epsilon value which represents the float error range within which you are willing to accept a "success" condition. It is normal for floats to be compared using an epsilon, for example: float e = 0.0001f; //epsilon public bool FloatEquals(float a, float b) { return Math.abs(a - b) <= e; } bool Vector2Equals(Vector2 a, ...


1

You probably want Lloyd's Algorithm. You'd confine the search space to the area contained within the original polygon, but would perform the iterations normally otherwise.


1

You basically have an ordered list of segments, making the segmented path you have described of that road. To smooth it up, you could simply take the centers of the segments and the points connecting them to create Bézeir curves from them. Read here for a detailed explanation of how it's done. Once you describe the path as connected Bézeir curves, it's ...


Only top voted, non community-wiki answers of a minimum length are eligible