Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to spawn GameObjects on corners of the liinear spline?
#1
I am trying to generate building walls using Prefabs.
The building spline is linear and nodes are placed on grid so they can form a polygon with regular walls (90 degrees turns). I am trying to fill it with groups of GO. 
1. How to set up Generator to spawn Prefabs exactly on corners of the linear spline?
2. Or how to find spots on corners?
3. How Curvy calculates a width of the prefab when spawning along the spline? It looks like the pivot of the GameObect is not so important.
4. Can I set the width of a prefab manually somehow? Just to convine the Generator that prefab has 0 (zero) or other specific width?

Sorry for so many questions but I am digging just to check if I can generate houses with Curvy Wink

Piotr
Reply
#2
Sorry I haven't answered you today. I will try to do so tomorrow.
Thanks for your patience, and have a nice day
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#3
Don't worry. I understand that you are busy and really appreciate that you spent time helping us with sometimes even stupid questions Wink
Reply
#4

  1. If you place objects through the generator, you can only place them with defined spacing. You can't set a dynamic spacing such as "at each corner"
  2. In your case, using a linear spline, corners are always positioned were your control points (CP for short) are. So just put your prefabs at the same position as your CPs.
  3. The calculation is based on the bounding volume of the object's mesh (and if any its collider too)
  4. You can by modifying the code. But there is a simpler method: just modify the value of "Space before" or "Space after" (both can be negative)
    https://curvyeditor.com/documentation/ge...ct=1#group
Please let me know if you have any other questions
Have a nice day
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#5
Thank you so much. I will be back after some testing.
Reply
#6
I am trying to prepare additional module to provide "Spots" with exact positions of the control points. Not computed.
Can you give me a hint please?

I am inside BuildRasterizedPath.cs
How to get list of Control Points (corners when Linear)
Can I get the CGShape data in InPath somehow to iterate on Positions and normals?
Reply
#7
I made this template to build rectangular mesh with corners based on the linear Curvy Spline:
   

The effect of the mesh spawning:
   


The problem was how to get Spline data directly from SplineInput. I couldn't find the reference through the InPath.
I did a hack and added serialized property to reference the same Spline again in my custom module.
With Spline ref I made CGPath by adding transform.localPosition and rotation from SplineSegments.

But maybe I could get a reference for Spline from InputSpline module directly?
Reply
#8
Raterize Path module takes a CGPath Spline Input module as an input. CGPath is just a succession of points. This means that the notion of a spline (control points, interpolation mode, etc) is not there. Your hack seems efficient enough knowing the constrains. Otherwhise, and to answer your question, you could do something like rasterizePathModule.InputLinks.First().ModuleID to get the id of the input 0f the module, then look in curvyGenerator.Modules for the one with the same id, cast it to InputSplinePath, then get its Spline property
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Dummy spline points hnngaf 0 12 11-14-2019, 02:08 PM
Last Post: hnngaf
  Refresh spline doesn't seem to be working dazz777 4 56 11-13-2019, 11:13 PM
Last Post: _Aka_
  Same Spline Extrusion with variable width MarioBag 5 656 11-04-2019, 01:56 PM
Last Post: _Aka_
  Change curvy gizmos to show direction of spline Horibe 1 45 11-01-2019, 07:02 PM
Last Post: _Aka_

Forum Jump: