Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
make a spline branch smoothly off another spline
#1
Hi, so I've got what I'll call my main spline ( bezier spline ) & I want to branch other splines ( bezier ) off it from various control points.
Here's a couple of screenshots to show what I mean.

I've sort of got it working how I want it but it doesn't always give great results.





[Image: screen1.jpg]


[Image: screen3.jpg]



So when a gameobject ( before runtime )is placed down the closest point on the spline is found using getnearstpointTF, 
the nearest 2 control points of the main spline with a lower TF value are found and the first 2 control points of the exit
spline are placed at the same position as the 2 main splines control points, the handles of the exit spline control points
are matched to the main splines control points handles.
  The 3rd control point of the exit spline ( CP0002 ) is then placed  2 unity units towards the gameobject.
Then by moving the handles I am able to get  the exit spline to have roughtly the same path as the main spline & curve away
when almost at the closest point on spline to the Gameobject ( as in 2nd diagram ).

Now would it be possible to to make the exit spline be more accurately placed on the path of the main spline as in the 2nd screenshot ?
Any advice / tips greatly appreciated.
Reply
#2
Hi,
I reuploaded your picture, but with annotations, so we can communicate easily:
   
To have the desired shape, you will need to add a control point at C on the exit spline. I see two ways of doing that:
  • A perfect one where you will have to code the code that subdivides a segment at a random position. This code is not part of Curvy, but I can help you figure out the math behind it if needed.
  • A not perfect solution, but that uses the current capacities of Curvy, so less coding: Use the Subdivide tool (or API method). This tools subdivides a segment at the middle. By consecutively subdividing the right segment, you will be able to create after some subdivisions a point close enough to the one you want. In the image I send you, I subdivided AB, which gave AH1 and H1B. Then subdivided H1B, then subdivided H1H2 to get a point close enought to C.
Did this help?
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
Hi thanks for your help. sorry took a while to reply.
I've got a control point at point C. I'm going to try a different approach to your suggestion, if that fails I'll be asking for some more advice.

Just one more question for now :  How could I get about 8 world positions on a spline between 2 control points ( the positions should be equal distances apart ) ?

Regards


EDIT : I've worked it out (Vector3 Interpolate( float tf )), I'm probably too eager to ask questions lol.
Reply
#4
InterpolateByDistance should better suit your needs
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
  Spawn object on Curvy Spline. ktpttd 3 104 11-20-2019, 01:38 PM
Last Post: _Aka_
  Dummy spline points hnngaf 1 65 11-17-2019, 06:01 PM
Last Post: _Aka_
  Refresh spline doesn't seem to be working dazz777 4 139 11-13-2019, 11:13 PM
Last Post: _Aka_
  How make a new connection between splines ? adeel_hamza 2 96 11-13-2019, 11:09 PM
Last Post: _Aka_

Forum Jump: