- Home /
Lerp position with curved paths
I don't know if you have ever played ratchet & clank 1 , its my alltime favorite game and decided to make a remake . Everything is going well but there is one thing that i can't understand . There is a part on the game where with some boots you get you can grind on rails to get to another place. the problem is that i can't find a way for the player to turn according to the position of the rail any way of making this ? Here is a pic of ratchet and clank BTN for smartphones (made in unity).
Answer by robertbu · May 04, 2014 at 11:09 PM
Typically moving along an irregular path is done using some sort of spline code. There are for purchase spline packages in the Asset store, but the free iTween has some basic spline functionality. If you want to control your own movement, you can use iTween.PointOnPath() and/or iTween.PutOnPath(). iTween also has a path editor. As for facing, if you use standard iTween functions like MoveTo(), you can tell iTween to rotate your character. If you are using iTween.PointOnPath() or iTweenPutOnPath() you just need the character to pick a point slightly ahead on the path and look at it. This assumes you setup your character correctly with his front facing positive 'z' when the rotation is (0,0,0).
will this work fine ? https://www.assetstore.unity3d.com/#/content/2506
Just from reading the description, it should work fine. iTween has a visual path editor as well. Also I've read some positive things about SuperSplines, though I've never used the package.
Answer by MariuszVR · Feb 13, 2021 at 09:28 PM
Hi, I wonder @electfall70 if you ever got somewhere with this type of movement you looked for?