Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Spawning Curvy Splines
#1
Hi,

I've been playing around with Curvy trying to work out how to achieve something, however I've had to admit defeat and I'm hoping someone here might be able to help me out.

Basically I'm trying use Pool Manager (from Path-o-logical) to randomly spawn a series of Curvy splines that I've setup as prefabs. With these spawned splines then being joined together to make a single spline. I've managed to get the process/logic of joining multiple instantiated splines to each other sorted with a little trial and error.

However getting Pool Manager to spawn the CurvySpline prefabs is where my plan come unstuck.

Pool Manager spawns prefabs using Unity.Transform, but obviously CurvySplines are not of the type Unity.Transform. Is there a way to cast CurvySplines as Unity.Transforms? Or is it a case that Curvy and Pool Manager are not going to play nice and I'll need to look at an alternative pooling system?

Any help or suggestions would be appreciated.

Regards,
Ewan
Reply
#2
Hi,

I don't know Pool Manager, but CurvySpline is just a component of a regular GameObject, so using mySpline.transform gives you the Transform. If nothing helps, just parent the Spline to an empty GameObject.

Jake
Reply
#3
(10-14-2013, 07:42 PM)Jake Wrote: Hi,

I don't know Pool Manager, but CurvySpline is just a component of a regular GameObject, so using mySpline.transform gives you the Transform. If nothing helps, just parent the Spline to an empty GameObject.

Jake

Hi Jake,

Thanks for the reply. I managed to solve my issue with a little Google-Fu and code bashing.

Your comment that CurvySpline was just a GameObject component got me searching on how to get components from transforms/gameobjects which led me to come up with this code which achieves what I wanted.
Code:
CurvySpline newSpline = prefabSpline.gameObject.GetComponent("CurvySpline") as CurvySpline;


Thanks again for your help and a cool plugin.

Regards,
Ewan
Reply
#4
(10-15-2013, 11:27 AM)Yog-Shoggoth Wrote: CurvySpline newSpline = prefabSpline.gameObject.GetComponent("CurvySpline") as CurvySpline;[/code]

This is C#, right? Then you can write it even shorter:

Code:
CurvySpline newSpline = prefabSpline.GetComponent<CurvySpline>();
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  snap to the curve created by the curvy splines segment points ShiroeYamamoto 1 2 1 hour ago
Last Post: _Aka_
  Curvy Line Renderer for UI Spline? gekido 1 1 1 hour ago
Last Post: _Aka_
Exclamation Extending Curvy Generator for Advanced Lofting - Feasibility Check amutp 2 4 Yesterday, 07:25 AM
Last Post: amutp
  8.8.0 is live, and it improves Curvy Generator greatly _Aka_ 0 6 Yesterday, 03:23 AM
Last Post: _Aka_

Forum Jump: