Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Render dynamically created spline
#1
Hi - Just bought Curvy and it may be the secret sauce to my game Wink

I have a question on rendering a spline I create dynamically. Basically, a player can select a "monster" object and then draw a spline for the monster to follow. I have it working in that the monster will follow the spline. However, how do I render the path so that visually the user can see the spline the monster will follow?

I see on the camera script there is a GLCurvyRenderer script, but can I dynamically add and remove splines to the renderer, and if so how? Or is there a better way of doing this than trying to use the renderer on the camera?

I am using Playmaker for what its worth, but if you have code samples/suggestions perhaps I can replicate it in playmaker.

Thanks in advance

Chris

 

 
Reply
#2
Hi Chris,

GLCurvyRenderer is a quick hack for debug visualization, it's highly inefficient as it rasterizes the path every frame. For short splines the performance is ok, but be warned that it renders above anything (i.e. acts like a 2D overlay). You should be able to dynamically add splines to the array using Playmaker. Another option would be a SplinePathMeshBuilder component with a rectangle shape.

A more sophisticated way will be available with the next major release. Hopefully it will be available around christmas, but don't count me on that.
Reply
#3
Hi Jake -

Thanks for the speedy reply. I didn't know about the SplinePathMeshBuilder option but I've investigated it and it looks like it will work! Is this a more efficient option than the GLCurvyRenderer?

Thanks
Chris
 
Reply
#4
Yes and no. Refreshing takes longer, but unlike GLSplineRenderer it refreshs only if the spline or Mesh settings change. 
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Best practice for mass-object instancing along 100km spline (railways) plus streaming bs@vectorvision.de 6 90 09-13-2019, 12:30 PM
Last Post: _Aka_
  How to spawn GameObjects on corners of the liinear spline? Pixel Flipper 4 52 09-13-2019, 08:04 AM
Last Post: Pixel Flipper
  How to properly set UV for extruded spline texture Pixel Flipper 3 61 09-05-2019, 11:55 AM
Last Post: _Aka_
  Steer Towards Spline whitecastleroad 3 76 09-04-2019, 01:39 PM
Last Post: _Aka_

Forum Jump: