Hay all. I have a problem.
I’m using iTween and I want to move a camera similar to how Crash Bandicoot’s camera move. It seems that CB’s camera has a path that it never leaves, however as Crash progresses through the level the camera moves along that path.
I was thinking that I draw the path, then attach a camera to that path, then get my chars position, and pretty much find where the camera should sit on the path based on my position.
Anyone have any idea how I should do this? Is this a sensible way of doing this?
Might I suggest Camera Path? I’ve included a demo of a Crash Bandicoot style camera here
This is going to be difficult with iTween’s path functionality (at least directly). There are spline packages in the Asset Store which have methods to find the closest point to the path.
You could also implement a path as a series of connected line segments through an array of Vectors. Finding the closest point or the closest line segment would be easy. Then you can find the closest point on the line segment. The Math3D script has ProjectPointOnLine() method if you need it.
Note if you want a smoother path, you can take the rough path and use iTween to generate a smooth path of points and then use the new points. You will also find a smoothing routine in this post:
http://answers.unity3d.com/questions/392606/line-drawing-how-can-i-interpolate-between-points.html