Demigiant Forum

Unity Assets => DOTween & DOTween Pro => Topic started by: abe on August 22, 2015, 04:32:27 PM

Title: Orientation "To path" and DoPath method
Post by: abe on August 22, 2015, 04:32:27 PM
Hello. Is it possible to use orientation to path and DoPath Method?
Title: Re: Orientation "To path" and DoPath method
Post by: Daniele on August 22, 2015, 08:34:37 PM
Hello!

Sure, chain a SetLookAt (http://dotween.demigiant.com/documentation.php?api=SetLookAt) immediately after creating the tween.
Title: Re: Orientation "To path" and DoPath method
Post by: abe on August 22, 2015, 09:48:20 PM
I did this but nothing work. What is the parameters should be in SetLookAt method?
Title: Re: Orientation "To path" and DoPath method
Post by: Daniele on August 23, 2015, 12:16:16 AM
To follow the path you should set it like this:
Code: [Select]
myTransform.DOPath(...path parameters...).SetLookAt(0.01f);
Title: Re: Orientation "To path" and DoPath method
Post by: abe on August 23, 2015, 12:15:10 PM
Thank you! it works for me. but for some reason it disable sprite renderer and i do not see object texture. I use 2d game mode.
Title: Re: Orientation "To path" and DoPath method
Post by: abe on August 24, 2015, 11:41:54 AM
I got the issue in my project only. i cannot repeat it in another project. When we use "set look at"  at object with spriteRenderer - spriteRenderer does not display texture.
Title: Re: Orientation "To path" and DoPath method
Post by: abe on August 24, 2015, 07:04:05 PM
I understand why sprite dissapears - for some reason when i enable setLookAt it start to rotate 2d sprite by x and y axis not only z. But when i added sprite to basic object i use to build path. It stops to do this. Mb it will be helpfull for somebody.
Title: Re: Orientation "To path" and DoPath method
Post by: Daniele on August 25, 2015, 02:24:53 PM
Hey, sorry for the late reply.

To avoid that issue when working with sprites, you can also set your PathMode parameter (in the DOPath method) to Sidescroller2D or TopDown2D, depending on how you're using your sprite.