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
Information Curvy 7.0.0 is live _Aka_ 5 56 05-26-2020, 06:12 PM
Last Post: Lupp_
Information Curvy 6.4.1 is live _Aka_ 0 58 05-12-2020, 10:33 AM
Last Post: _Aka_
  Is Curvy good for my project ? SirKnightDragoon 1 113 05-05-2020, 08:37 PM
Last Post: _Aka_
  Placing multiple objects on multiple splines digot 5 638 04-26-2020, 06:20 PM
Last Post: _Aka_

Forum Jump: