LineRenderer in DOTween PRO
« on: May 28, 2015, 06:39:08 PM »
Hi,

Is DOTween Pro capable of drawing the line (Catmull rom) created by using the Path Manager, so the created lines would be seen also after launching the game not only in Gizmos?

Thanks,
Szymon

*

Daniele

  • Dr. Admin, I presume
  • *****
  • 378
    • View Profile
    • Demigiant
Re: LineRenderer in DOTween PRO
« Reply #1 on: May 28, 2015, 08:39:29 PM »
Hi,

Sorry but no, lines are only drawn as a visual cue in the Editor, not in the game itself.

Cheers,
Daniele

Re: LineRenderer in DOTween PRO
« Reply #2 on: May 28, 2015, 09:22:36 PM »
Thanks for the quick respond!
Is there any way to get the coordinates of the intermediate points between the waypoints, so I could use it to draw a line?

*

Daniele

  • Dr. Admin, I presume
  • *****
  • 378
    • View Profile
    • Demigiant
Re: LineRenderer in DOTween PRO
« Reply #3 on: May 29, 2015, 10:26:01 AM »
I'm adding this to my todo list. I'm working on other DOTween Pro features right now, but I'll see if I can push this forward, since it shouldn't be too difficult.

*

Daniele

  • Dr. Admin, I presume
  • *****
  • 378
    • View Profile
    • Demigiant
Re: LineRenderer in DOTween PRO
« Reply #4 on: May 30, 2015, 01:44:02 PM »
Voilą :)

If you didn't already do it, update to DOTween Pro's latest version, then overwrite the Demigiant/DOTween folder with the one attached here. After that, you can do:

Code: [Select]
myDOTweenPath.GetTween().PathGetDrawPoints();
to get a series of points you can use to draw the path at runtime. Note that PathGetDrawPoints also accepts an optional parameter to tell it how many subdivisions per segment to create. The higher the subdivisions, the more points will be generated and the more curved it will look when drawn (in case of curved paths: it's completely ignored in case of linear ones). The default value, 10, should be already ok anyway.

Here is also an example MonoBehaviour that I used to test it:

Code: [Select]
using UnityEngine;
using System.Collections;
using DG.Tweening;

public class PathsWDrawPaths : MonoBehaviour
{
public DOTweenPath path;
public int subdivisionsXSegment = 10;
public Color startColor = Color.white;
public Color endColor = Color.white;
public float startW = 1;
public float endW = 1;
public Material material;

void Start()
{
Vector3[] drawPoints = path.GetTween().PathGetDrawPoints(subdivisionsXSegment);

int pointsCount = drawPoints.Length;
LineRenderer lr = path.gameObject.AddComponent<LineRenderer>();
lr.material = material;
lr.SetColors(startColor, endColor);
lr.SetWidth(startW, endW);
lr.SetVertexCount(pointsCount);
for (int i = 0; i < pointsCount; ++i) lr.SetPosition(i, drawPoints[i]);
}
}

Re: LineRenderer in DOTween PRO
« Reply #5 on: July 09, 2015, 10:55:06 PM »
Thank you for updates. By using DOTween I managed to finish the game :)

*

Daniele

  • Dr. Admin, I presume
  • *****
  • 378
    • View Profile
    • Demigiant
Re: LineRenderer in DOTween PRO
« Reply #6 on: July 09, 2015, 11:56:52 PM »
That is great to hear, and I applaud you! Link, link! :)

Re: LineRenderer in DOTween PRO
« Reply #7 on: July 10, 2015, 10:43:04 AM »

*

Daniele

  • Dr. Admin, I presume
  • *****
  • 378
    • View Profile
    • Demigiant
Re: LineRenderer in DOTween PRO
« Reply #8 on: July 10, 2015, 03:30:42 PM »
Nice! :)

Re: LineRenderer in DOTween PRO
« Reply #9 on: November 11, 2015, 07:16:04 PM »
Bump!

I cannot get the PathGetDrawPoints from DOTween pro 0.9.380 - there is no such method or extension in any namespace inside DG.

Could you provide me with solution?

*

Daniele

  • Dr. Admin, I presume
  • *****
  • 378
    • View Profile
    • Demigiant
Re: LineRenderer in DOTween PRO
« Reply #10 on: November 11, 2015, 07:56:30 PM »
I just checked and it's there indeed. Are you sure you imported the correct namespace? It's DG.Tweening, not just DG.

Re: LineRenderer in DOTween PRO
« Reply #11 on: November 12, 2015, 12:14:52 AM »
I double checked and found that the issue was with priviledges to DOTween.XML files - once I set them straight I was able to correctly update plugin and mentioned method was there.

Thank you

*

Daniele

  • Dr. Admin, I presume
  • *****
  • 378
    • View Profile
    • Demigiant
Re: LineRenderer in DOTween PRO
« Reply #12 on: November 12, 2015, 01:47:12 AM »
Weird, first time I hear about that. Thanks for letting me know.