2D Toolkit Forum
2D Toolkit => Support => Topic started by: Artheus on January 20, 2014, 09:21:23 pm
-
I'm trying to draw the paths of my units using code from this page: http://wiki.unity3d.com/index.php?title=VectorLine (http://wiki.unity3d.com/index.php?title=VectorLine) but can't get anything to show up.
Does anyone know of a good solution to draw things to the screen? Does the GL class even work with 2d toolkit?
-
GL works fine with 2D Toolkit. I'm not sure about that particular bit of code - it doesn't seem to be setting any matrices. I've used it before so I couldn't give you specific advice - I'd look into setting the projection matrix from the camera first. The other thing worth looking into - try scaling the lines, your camera might be a bit bigger / smaller than the size this code expects.
-
Do you have any examples using the GL class? And I'm just using the points from from my units position and it's path, what kind of transformation do I need to do?
-
No examples off hand. What camera are you using and does that example code work with a normal orthographic camera?
-
I'm just using the default 2d toolkit camera set to orthographic and no, it doesn't work with a unity camera set to orthographic. What does that mean?
-
If it doesn't work with an ortho camera, it isn't going to work with a tk2dCamera. It suggests the script isn't going to work properly - perhaps was written for an older version of Unity? tk2d doesn't do anything special here, you will need to find one that works with a normal unity camera for it to work with the tk2dCamera.
At the end of the day drawing lines with GL is terribly inefficient, its far better to build your own mesh and draw it, or use Vectrosity or something like that.
-
I wanted to avoid Vectrosity for as long as possible (30 bucks is kinda steep) but I bought it now and it works perfectly. Thanks for the help.
-
I wanted to avoid Vectrosity for as long as possible (30 bucks is kinda steep) but I bought it now and it works perfectly. Thanks for the help.
Hi Artheus,
could you post an example script, how you got Vectrosity to work with the 2D Toolkit cam?
Best regards,
Josef