*

abe

  • ***
  • 11
    • View Profile
Orientation "To path" and DoPath method
« on: August 22, 2015, 04:32:27 PM »
Hello. Is it possible to use orientation to path and DoPath Method?

*

Daniele

  • Dr. Admin, I presume
  • *****
  • 378
    • View Profile
    • Demigiant
Re: Orientation "To path" and DoPath method
« Reply #1 on: August 22, 2015, 08:34:37 PM »
Hello!

Sure, chain a SetLookAt immediately after creating the tween.

*

abe

  • ***
  • 11
    • View Profile
Re: Orientation "To path" and DoPath method
« Reply #2 on: August 22, 2015, 09:48:20 PM »
I did this but nothing work. What is the parameters should be in SetLookAt method?

*

Daniele

  • Dr. Admin, I presume
  • *****
  • 378
    • View Profile
    • Demigiant
Re: Orientation "To path" and DoPath method
« Reply #3 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);

*

abe

  • ***
  • 11
    • View Profile
Re: Orientation "To path" and DoPath method
« Reply #4 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.

*

abe

  • ***
  • 11
    • View Profile
Re: Orientation "To path" and DoPath method
« Reply #5 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.

*

abe

  • ***
  • 11
    • View Profile
Re: Orientation "To path" and DoPath method
« Reply #6 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.

*

Daniele

  • Dr. Admin, I presume
  • *****
  • 378
    • View Profile
    • Demigiant
Re: Orientation "To path" and DoPath method
« Reply #7 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.