- Home /
iTween - Path inside other path
Hello,
I need to put a path inside a parent path, but I think it isn't possible with iTween because it calculates the nodes of the paths with global location.
In fact what I need is a parent path making a space ship and a camera advance and inside that path I need another path moving the camera around (special movements, not only orbit) the spaceship. But second path is a list of vector3, they aren't real gameobjects nodes and their positions aren't modified by their parents location.
Now I'm using a modification of Interpolate but iTween has a lot of options I'll be glad to use.
Ideas? Thanks!!!
I have an untested theory. iTween paths can be an array of Vector3s or an array of Transforms. If you formed your camera path out of child objects to the ship and made the path out of these Transforms, then the path should travel with the ship.
Thanks, I've didn't realize about that, but I've just tried and it doesn't work. The problem is iTween doesn't calculate the path on the fly, it's all precalculated.
Here is a bit of a hack:
Construct your camera path relative to the world origin
$$anonymous$$ake your camera a child of the ship
Send an empty game object around the camera path
Set the local position of the camera to the position of the empty game object
iTween.PointOnPath() and iTween.PutOnPath() dynamically calculate path position, so you should be able to use these with a path of Transforms. I'm not sure what you get beyond Interpolate in the Wiki doing it this way though.