DOTweenPath orientation and rotation options
« on: August 21, 2015, 06:23:56 PM »
Hi DoTween users,
I'm wondering if there is a way to lock my character X and Z rotation when he is following a path.
I would basically to make him only rotate on the Y axis,=,
This way Orientation "To Path" would not make it bank in weird way when he is going down stairs...

I am not sure how I can override the waypoints tween transform results after each frame...

In the "Path Tween Options", it would be nice to have checkboxes to decide which axis  can't be influenced by the Orientation settings,
or there is a way to do it programatically?

Cheers

Re: DOTweenPath orientation and rotation options
« Reply #1 on: September 21, 2015, 01:34:20 PM »
Hello, I don't know if that is what you are (were?) searching for:
http://dotween.demigiant.com/documentation.php#tweenerOptions

And so in your case:
SetOptions(AxisConstraint.None, AxisConstraint.X | AxisConstraint.Z)


Re: DOTweenPath orientation and rotation options
« Reply #2 on: September 23, 2015, 11:49:51 PM »
Thanks Aberdyne!
I'll look into the SetOptions()

For anyone wanting to add some furter path customization, I solved my issue by overriding the transform on each tween update:

Code: [Select]
GetComponent<DOTweenPath>().GetTween().OnUpdate(OnPathUpdate);

protected void OnPathUpdate()
{
    // Disables any other path orientation than the Y axis
    transform.localRotation = Quaternion.Euler(0, transform.localRotation.eulerAngles.y, 0);
}