Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Create an arrow dynamically following the spline
#1
Hello, I have just begin to use the asset and look awesome. I'm not sure which is the best way to accomplish what I need, so here is my goal:
I need to have a 2d arrow (image or images but not a line renderer) on the UI Canvas that get the shape of the spline, so that when I change the control points positions of the spline the arrow adapt to the spline aswell. As I am not sure if I explain myself well I made a simple graphic to demonstrate what I want to achieve:
[Image: 7bbNTnA.jpg]
Its that possible? I see with spline controller you can move a sprite across the spline using it as a path, but the sprite remains always the same and this is not what I want.
Thank you in advance Smile


Attached Files Image(s)
   
Reply
#2
Try using a CurvyLineRenderer with an arrow texture. The new LineRenderer in 5.5 is somewhat usable, though not perfect. Btw, a new Curvy version removing the 5.5 warnings is on the way...
Reply
#3
(12-22-2016, 08:11 PM)Jake Wrote: Try using a CurvyLineRenderer with an arrow texture. The new LineRenderer in 5.5 is somewhat usable, though not perfect. Btw, a new Curvy version removing the 5.5 warnings is on the way...

Thank you for the solution. It works as intended with the Curvy Line Renderer script. The problem I have now is that the spline is on the UI Canvas, and it works only on scene mode, on play mode the line renderer doesnt show at all. Any ideas why or how could a solve it?

Thank you again
Reply
#4
Either you have a layering issue (UI overlapping the line renderer) or you did not wait for spline initialization (only happens if you feed the line renderer by some script).
Reply
#5
(01-15-2017, 09:35 AM)Jake Wrote: Either you have a layering issue (UI overlapping the line renderer) or you did not wait for spline initialization (only happens if you feed the line renderer by some script).

I already hide the rest of the elements of the UI Canvas and I still cant see the spline on the game tab or game mode (it works perfect on scene tab or scene view). I also disabled all access to the spline from code (because from code I just move the control points positions and thats it) but still cant see it. I tried all kind of materials but no luck either. I have read on forums that you cant render a Line Renderer on a UI Canvas with Screen Space - Overlay as a render mode, but I dont know if that info is obsolete or there isnt a way to do it. 


Any ideas of how could I solve it?
Thank you again
Reply
#6
My knowledge of uGUI, especially when mixing with regular components, is limited. CurvyLineRenderer isn't any different than the regular LineRenderer script beside it fills the points array, that's all I can say - so it's unlikely that the problem is caused by our inherited LineRenderer.

Perhaps anyone else got a good idea!?
Reply
#7
(01-18-2017, 07:36 PM)Jake Wrote: My knowledge of uGUI, especially when mixing with regular components, is limited. CurvyLineRenderer isn't any different than the regular LineRenderer script beside it fills the points array, that's all I can say - so it's unlikely that the problem is caused by our inherited LineRenderer.

Perhaps anyone else got a good idea!?


I tried a different approach. Now I add a new canvas with screen space - camera to the player and now I can see the cury line renderer on the camera. The problem is I cant see always, it dissapears when I look with the player (its an fps) to the front. If I look to the back or to both of sides I can see the curve, but there is a cone in front on the player that cant let me see the curve and no idea why.


Any ideas?
Reply
#8
(01-26-2017, 11:46 AM)yandrako Wrote:
(01-18-2017, 07:36 PM)Jake Wrote: My knowledge of uGUI, especially when mixing with regular components, is limited. CurvyLineRenderer isn't any different than the regular LineRenderer script beside it fills the points array, that's all I can say - so it's unlikely that the problem is caused by our inherited LineRenderer.

Perhaps anyone else got a good idea!?


I tried a different approach. Now I add a new canvas with screen space - camera to the player and now I can see the cury line renderer on the camera. The problem is I cant see always, it dissapears when I look with the player (its an fps) to the front. If I look to the back or to both of sides I can see the curve, but there is a cone in front on the player that cant let me see the curve and no idea why.


Any ideas?

After lots of trying different options, I manage to accomplish what I intended. For that I had to attach the curvy spline with the line renderer to the player camera itself, instead to the UI canvas. I thought I finally get my happy ending but I have one last quality issue:

Now on game mode works perfect, but when I make the PC build and run the .exe, the line renderer seems to loose many of the positions from the curvy, only get some keypoints and interpolate rect lines between them. To explain myself better I add captures:

Working as intended in game mode
   
Not working correctly running .exe
   
Settings of the curvy + line renderer used (the spline have 3 cp)
   
I am really happy with the result of game mode, and it probably has to be some build setting but have no idea what it could be. Any know what could be?
Thank you again and sorry for all the messages I had to write.
Reply
#9
(03-01-2017, 12:05 PM)yandrako Wrote:
(01-26-2017, 11:46 AM)yandrako Wrote:
(01-18-2017, 07:36 PM)Jake Wrote: My knowledge of uGUI, especially when mixing with regular components, is limited. CurvyLineRenderer isn't any different than the regular LineRenderer script beside it fills the points array, that's all I can say - so it's unlikely that the problem is caused by our inherited LineRenderer.

Perhaps anyone else got a good idea!?


I tried a different approach. Now I add a new canvas with screen space - camera to the player and now I can see the cury line renderer on the camera. The problem is I cant see always, it dissapears when I look with the player (its an fps) to the front. If I look to the back or to both of sides I can see the curve, but there is a cone in front on the player that cant let me see the curve and no idea why.


Any ideas?

After lots of trying different options, I manage to accomplish what I intended. For that I had to attach the curvy spline with the line renderer to the player camera itself, instead to the UI canvas. I thought I finally get my happy ending but I have one last quality issue:

Now on game mode works perfect, but when I make the PC build and run the .exe, the line renderer seems to loose many of the positions from the curvy, only get some keypoints and interpolate rect lines between them. To explain myself better I add captures:

Working as intended in game mode

Not working correctly running .exe

Settings of the curvy + line renderer used (the spline have 3 cp)

I am really happy with the result of game mode, and it probably has to be some build setting but have no idea what it could be. Any know what could be?
Thank you again and sorry for all the messages I had to write.




Any ideas on this? Im still a bit lost and I think it has to be something simple Sad
Reply
#10
(03-20-2017, 09:07 AM)yandrako Wrote:
(03-01-2017, 12:05 PM)yandrako Wrote:
(01-26-2017, 11:46 AM)yandrako Wrote:
(01-18-2017, 07:36 PM)Jake Wrote: My knowledge of uGUI, especially when mixing with regular components, is limited. CurvyLineRenderer isn't any different than the regular LineRenderer script beside it fills the points array, that's all I can say - so it's unlikely that the problem is caused by our inherited LineRenderer.

Perhaps anyone else got a good idea!?


I tried a different approach. Now I add a new canvas with screen space - camera to the player and now I can see the cury line renderer on the camera. The problem is I cant see always, it dissapears when I look with the player (its an fps) to the front. If I look to the back or to both of sides I can see the curve, but there is a cone in front on the player that cant let me see the curve and no idea why.


Any ideas?

After lots of trying different options, I manage to accomplish what I intended. For that I had to attach the curvy spline with the line renderer to the player camera itself, instead to the UI canvas. I thought I finally get my happy ending but I have one last quality issue:

Now on game mode works perfect, but when I make the PC build and run the .exe, the line renderer seems to loose many of the positions from the curvy, only get some keypoints and interpolate rect lines between them. To explain myself better I add captures:

Working as intended in game mode

Not working correctly running .exe

Settings of the curvy + line renderer used (the spline have 3 cp)

I am really happy with the result of game mode, and it probably has to be some build setting but have no idea what it could be. Any know what could be?
Thank you again and sorry for all the messages I had to write.




Any ideas on this? Im still a bit lost and I think it has to be something simple Sad


Savior Jake, you there? xD
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Trying to create a moving train that slows and stops at stations Novian 7 192 09-13-2018, 08:46 PM
Last Post: ClaudePorter
  Freewalk mode, then return to spline mythstified 6 152 08-30-2018, 10:29 AM
Last Post: Jacki
  Creating a threaded pole along a spline? spedepasanen 1 73 08-14-2018, 12:25 PM
Last Post: _Aka_
  Generate Spline and Segments dynamically with a script?? mythstified 3 146 08-10-2018, 12:43 PM
Last Post: _Aka_

Forum Jump: