Drawing path with finger?

Hi,

We have just begun looking into our second game and is checking out different ways of input…
We have a idea of an actiongame with input much like FlightControl/LineRider, i.e you just draw the path with your finger…

How is this possible in unity?
We were looking into using Raycasting upon the surface, instantiating GameObjects (or perhaps some node-class alike) at certain points (with a minimum distance from the last node, just to lower the total) and then walking between these points
The “dotted” line would actually be created using SpriteManager

Now the questions:

  1. How can we smoothly make our object follow the track?
  2. How can we determine the correct way to face the next Node (pr perhaps, the next point on the path between the Nodes…)

I’ve looked at the SplineController in the wiki, but it seems really hard to work with, any thoughts?

BR

  1. Use the “key points” (where there is a direction change) as control points for a spline for example and interpolate along that. (or create a catmull rom through all the points)

  2. Thats simple math.
    The required direction angle from your point to the target point - your current one gives you the angular difference by which you have to correct your heading.

Learning interpolation and splines etc isn’t simple but you will potentially have to do it.
There is no easy “click and do it for me” way

Ok, I’ve been struggling with Catmull-Rom splines for 2 days now…
I get a working spline but then I get huge variations in speed

I’ve tried reparameterization with arc-length but I just can’t get it to work…
Anyone here who have some good links, perhaps even with examplecode?
Any codelanguage should work, just so I can get some pointers

BR

Maybe you can glean something useful from the attached script. I don’t remember where I found this, but we use it for camera paths. I’m not sure if it will run as-is because I may have changed it for our purposes, but you should be able to get an idea of how it works.

177445–6344–$splineinterpolator_673.js (7.45 KB)