I am beginner level Unity3D user. I’ve just recently seen iTween. It provides a rich and usefull set of tools.
I am trying to move an airplane along a path generated using iTween path editor. Following is the code attached to the airplane object.
using UnityEngine;
using System.Collections;
public class CircuitFlight : MonoBehaviour {
// Use this for initialization
void Start () {
iTween.MoveTo(gameObject, iTween.Hash("path", iTweenPath.GetPath("FlightPath01"), "time",10, "islocal",true, "orientToPath",true));
}
}
Airplane object follows the path. But, it doesn’t correctly orient itself to the path. The airplane object has a hierarch, (empty game obj, fuselage and propeller). I’ve also tested the same code on an ordinary cube. Result is the same; i.e. I could not get “orinetToPath” to work.
Can someone advise me how to move an object over a path and orient its motion to the path?
Thank you “pixelplacement1”; iTween is an excellent tool set that everybody must have.
Adding "adding a “lookTime” property around of around .2. " as you suggested helped (altough in my application “orientToPath” still seems to be not perfect). It seems to be that the relative locations of the of the path nodes make big difference.
using UnityEngine;
using System.Collections;
public class CircuitFlight : MonoBehaviour {
// Use this for initialization
void Start () {
iTween.MoveTo(gameObject, iTween.Hash("path", iTweenPath.GetPath("FlightPath01"), "time",30, "islocal",true, "orientToPath",true, "lookTime", 0.2));
}
}
I wish iTween path editor would allow us to play with more than 10 nodes. And it would also allow us to delete a selected node (not only deleting the last node) and insert (not append) a node to a position pointed by the mouse.
I want to simulate an airplane movement without looking too fake. Airplanes don’t go from point A to B, but they roll and pitch to arrive to that point based on where they are headed at the moment.
Hi,
First of all, awsome tool iTween, thanks for making it!
I’m having some issues with the orientToPath. The orientation is way off. It seems like it rotating too early, or just skipping rotation on some parts. Even when adding the lookTime part in there it seems to make no difference no matter what value i use. Here is my code for it.
And this works fine, the object moves up and down it’s path. But when I add “orienttopath”, true, the character essentially freezes, with minor movement in the z axis. I’ve added looktime but that doesn’t seem to resolve the issues. Any ideas why?
THanks
Thanks!
Just wondering where the changing of the limit of 10 is on your blog? I have looked over and searched keywords for the limit to be higher as well and I see nothing that indicates how to up the limit of points on the path?
Is that all that’s involved is changing:
_target.nodeCount = Mathf.Clamp(EditorGUILayout.IntSlider(_target.nodeCount, 0, 10), 2,100);