Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Generate Spline and Segments dynamically with a script??
Ok so I have an ambitious idea where I want to make a dynamic path routing algorithm.  So far I got a script that detects the road texture, tries to find the middle of it, and plops a cube in the middle... then repeats every 30 meters... anyway, instead of a cube, I plan to put a spline control point.  I've only ever made splines with the GUI interface.

I've been fishing around the API and am utterly confused.

Here's the rather simple code I'm using for the middle cubes:
           midPathMarkers[i].transform.localPosition = new Vector3(xPos, hit.point.y+4, zPos);
           midPathMarkers[i].transform.localScale = new Vector3(4, 4, 4);

Here's what my algorithm currently does.

[Image: XNWJYif.jpg]

I plan to have it detect when you're coming close to a fork in the road and the user will choose left/right.  But you can also press a button and "free roam" with no spline, then press another button and it'll create a new spline to the nearest dirt road and continue with the pathing algorithm. 

It'll be so cool if this works.  I need the simple above, but if you have any other tips or things to keep in mind while doing such a task please let me know!


Messages In This Thread
Generate Spline and Segments dynamically with a script?? - by mythstified - 08-09-2018, 03:32 AM

Possibly Related Threads...
Thread Author Replies Views Last Post
  Spawn object on Curvy Spline. ktpttd 3 26 Yesterday, 01:38 PM
Last Post: _Aka_
  Dummy spline points hnngaf 1 30 11-17-2019, 06:01 PM
Last Post: _Aka_
  Refresh spline doesn't seem to be working dazz777 4 71 11-13-2019, 11:13 PM
Last Post: _Aka_
  Same Spline Extrusion with variable width MarioBag 5 689 11-04-2019, 01:56 PM
Last Post: _Aka_

Forum Jump: