Moving a GameObject along a Custom (Curved) Spline

Hi guys,
After having extensively searched unityAnswers, the forum, the internet… I can’t seem to find the solution to what I’m sure is a very simple problem.

I’m trying to make a 3rd person on-rails shooter. Really simple - a GameObject following a long spline that will curve at points, go straight at others, incline, decline etc. Like one can easily do in modelling software like Cinema 4D.

I found a few people that had asked this question, but never a conclusive answer. In my search I found the Spline Controller on the Unify Wiki (http://wiki.unity3d.com/index.php?title=Spline_Controller). But from what I can work out it only handles straight splines?

This must have a simple solution, they were doing this all the time in the 90s!! :slight_smile:
Thanks in advance to anyone willing to share some wisdom with me, really appreciate the help.

stop me if you've already heard this one, but have you investigated itween for unity? it has path movement and sounds like what you'd need http://itween.pixelplacement.com/documentation.php

Thanks for the reply zombience , I did actually read about it on a forum but the person was dismissing it as being performance heavy and useless when it came to iOS so I didn't look into it any further. Do you have any experience using it? Edit: I see that iTween is only for C# development? What a shame, it looked great.

I am working on a project with the same concept as described above, yet I want the player to be able to move the object/camera forward and backward along the path . Many of the solutions posted here seem to be more suitable for an animated camera flythrough. I'd be very happy if someone has a hint on this.

3 Answers

3

http://wiki.unity3d.com/index.php/Hermite_Spline_Controller

The screen shot on this page shows curved splines, so I don’t think it’s straight splines only. Alternative, visit Google and enter:

site:u3d.as spline

and hit the search button. You’ll get loads of solutions. Perhaps your extensive search was faulty? :wink:

Well I have to admit I am a little embarrassed as Hermite looks like a great solution. I blame my n00by lack of confidence :-) so from one Graeme to another (Graham), thanks so much.

that's intriguing about the "u3d.as" idiom ... does that mean the site is "registered" in some way with google, that google knows that abbreviation? Good one

Hey fattie, that's something I can help you understand - I'm an SEO :-) site: is a search operator that filters your search so that Google only returns results for your given keyword that are hosted on the given website. As Graham illustrated the syntax is like so: site:domain.com keyword So yes u3d.as, the unity asset store, is "registered" with Google in a way: The pages hosted on the domain have been crawled and indexed by Google, and therefor show up in search results. Hope this helps!

SEO = Search Engine Optimizer (save you having to look it up if, like me, you didn't know :)

hey David if you’re still looking at this,

the absolutely perfect solution is

there are a number of competing packages on the asset store. we bought them all and that’s the best one.

“This must have a simple solution” … by no means. it takes expert programming in a number of fields and mathematics. we have lots of code base for mesh extrusion, splines etc but it’s the sort of thing where it’s much. much more intelligent to just use an existing proven package.

with that package (or indeed the competitor packages), the job is done. hope it helps

Hi. I'm looking at that extension. Do you know how to use it with root animation? For example if I have a rolling forward animation, how can I make my model following a spline while rolling but still keep the root animation? Thank you!

I’ve just tried a free asset called Surge that does the job.
It has many cool features, not only splines but also tweens and others I haven’t tried yet.