Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Getting reference to Generator and InputSplinePath Spline
#1
Since only part of spline that can trigger collision is Mesh (FluffyUnderware.Curvy.Generator.CGMeshResource) how to get reference to its root (Generator) and Spline Path when collision with other object occurs?
Doing otherCollider.gameObject.transform.root.GetComponentInChildren<CurvySpline>() can result in multiple object for detecting Spline Path since same component is present in Spline Shape. 
On the other hand root of Spline can be other gameobject (not Generator and it is not component) so false positive is possible.
Reply
#2
Hi

Here is some code that should make things clearer:

Code:
Transform meshParent = mRenderer.transform.parent;
CreateMesh createMeshModule = meshParent.GetComponent<CreateMesh>();
CurvyGenerator generator = createMeshModule.Generator;
List<InputSplinePath> inputSplinePathModules = generator.FindModules<InputSplinePath>(true);

I hope this helped.
Have a nice day
Available for freelance work, feel free to reach out: toolbuddy.net
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Reply
#3
Ahaaaa .... Thanks a lot!
Reply
#4
Needed to add
using FluffyUnderware.Curvy.Controllers;
using FluffyUnderware.Curvy.Generator; // This and
using FluffyUnderware.Curvy.Generator.Modules; // This one
using FluffyUnderware.DevTools;

and then all worked with collider that I got from:
private void OnCollisionEnter(Collision other) {
CurvyGenerator generator = other.gameObject.GetComponent<CGMeshResource>().transform.parent.GetComponent<CreateMesh>().Generator;
CurvySpline inputSplinePathModules = generator.FindModules<InputSplinePath>(true)[0].Spline;
}

if someone needs it.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  SplineController Ignores Follow-Up and Chooses Wrong Spline Josenildo 7 2,341 07-29-2025, 09:15 PM
Last Post: _Aka_
  Curvy Line Renderer for UI Spline? gekido 7 3,921 07-13-2025, 07:11 PM
Last Post: _Aka_
  Is there a way to get the position of each ControlPoint in spline by API? Chanon 1 1,466 06-07-2025, 09:44 AM
Last Post: _Aka_
  How to rotate generator asteroids patndan74 6 2,429 05-08-2025, 10:07 PM
Last Post: _Aka_

Forum Jump: