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
  Curvy Line Renderer for UI Spline? gekido 5 13 10-29-2024, 10:19 AM
Last Post: _Aka_
Information New free asset: Converter For Dreamteck Splines _Aka_ 0 0 07-19-2024, 08:27 PM
Last Post: _Aka_
Information New free asset: Converter For Unity Splines _Aka_ 20 61 07-19-2024, 05:15 PM
Last Post: _Aka_
  Invisible Gizmos In Latest Curvy Splines orrenravid1 1 5 06-11-2024, 07:36 AM
Last Post: _Aka_

Forum Jump: