- Home /
How to orient object to road/itweenpath
hi everyone,
I have designed a roller coaster path with easyroads3d and itweenpath. Although I have implemented position update and lookAt functionalities(I update the position with itween.pointonpath function and look direction with transform.lookat function), I couldn't make the object orient the local rotation around y/z axis. How can I set the local up and local forward vectors? I just wanted to set the forward(but in local) vector as pointpositionforward-pointposition and right(but in local) vector as pointposition2-pointposition. I hope I make myself understood. Thanks in advance.
Answer by AdamAz · Apr 16, 2015 at 08:59 AM
Hi,
if you are using iTween.MoveTo function you could try one of it's parameters called 'orienttopath' it should automatically rotate your object to face the path. Example:
iTween.MoveTo(gameObject,
iTween.Hash("path", iTweenPath.GetPath(data.path.pathName), "time", data.pathTransitionTime, "orienttopath",true));
Your answer
![](https://koobas.hobune.stream/wayback/20220612095151im_/https://answers.unity.com/themes/thub/images/avi.jpg)