Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Noob Question
#1
So, this is probably the easiest thing ever, but I can't seem to figure it out.
I'm trying to make some code that'll connect 2 objects together with a noodle, like in all the node editors.
Here's my code so far:
Code:
using UnityEngine;
using FluffyUnderware.Curvy;


namespace Connections {
public class Connection : MonoBehaviour {
        private CurvySpline myspline;
        public void SetPosition(Vector2 start, Vector2 end) {
            if (!myspline) myspline = CurvySpline.Create();
            myspline.Clear();
            myspline.Add(
                start,
                new Vector3(start.x + ((end.x - start.x) * (float)0.2), start.y, 0),
                new Vector3(end.x + ((start.x - end.x) * (float)0.2), end.y, 0),
                end);
            myspline.Refresh();
        }
    }
}


This works, and I can see the splines appear in the editor.
I can't figure out how to take my new spline and build a mesh around it with code.
I know how to add the mesh in the editor, but I need this to be pure code that updates and changes constantly during runtime.

My question is:
What code do I need to add to this to give it a mesh?
Reply


Messages In This Thread
Noob Question - by Wyldhunt - 09-02-2021, 11:53 PM
RE: Noob Question - by _Aka_ - 09-03-2021, 09:10 AM
RE: Noob Question - by Wyldhunt - 09-03-2021, 07:06 PM
RE: Noob Question - by _Aka_ - 09-03-2021, 07:40 PM
RE: Noob Question - by Wyldhunt - 09-04-2021, 06:23 PM
RE: Noob Question - by _Aka_ - 09-04-2021, 06:53 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Newbie Question: Uniformly increase spacing between volume spots? SAMYTHEBIGJUICY 1 5 09-01-2023, 03:38 PM
Last Post: _Aka_
  I have a question about curvySpline haifeng.huang 12 32 07-14-2023, 09:34 AM
Last Post: _Aka_
  Question about generator Mos Def 7 1,807 04-10-2023, 10:20 PM
Last Post: _Aka_
Question Connection Question dazz777 1 121 11-22-2021, 01:42 PM
Last Post: _Aka_

Forum Jump: