Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bug in Spline makes unity freeze
#12
(01-12-2014, 11:31 AM)'Jake' Wrote: Yeah, nice. But I need the actual settings (from the Inspector, so UV settings, Extrusion mode etc...)...


 
I created a DynamicPath obj which has a component of Curvy Spline.
This is the set up.
http://oi44.tinypic.com/2z670if.jpg

In this picture I have a high amount of splines (each yellow dot is a dot in the spline)
http://oi41.tinypic.com/2a7hr0i.jpg

As soon a dot is being created, I assign a CurvyMeshPath and only at the end of the drawing (when the player starts the game) I add a mesh collider.


I have this MakeAPoint function which is quite long, it also gives stacks a location and info about every point (for an Undo button).



Code:
void MakeAPoint()
{
if (cut && !afterCut) //cut point
{
afterCut = true;
cut = false;
wasCut = true;
CurvySpline newCS = CurvySpline.Create();
newCS.name = "DynamicPath" + index;
index++;
newCS.tag = "Track"; //Delete this track also
newCS.InitialUpVector = CurvyInitialUpDefinition.ControlPoint;
current_spline = newCS;
CreateMeshBuilder();
splineStack.Push(current_spline);
}
else if (afterCut)
{
cutButton.SetActive(true);
afterCut = false;
}

point = current_spline.Add(newDotPosition);
Transform dot = point[0].transform;
segmentStack.Push(point[0].gameObject);
dot.tag = "Track";
CreateTempPoint();

if (first) //First point
{
first = false;
second = true;
firstDot = dot.position;
CreateMeshBuilder();
splineStack.Push(current_spline);
}
else if(second) //Second point
{
if (heightChanged)
{
heightChanged = false;
dirVector = newDotPosition - lastDotPosition; //This is the direction vector
dirVector.y = 0;

CurvySplineSegment css = current_spline.PreviousControlPoint(point[0]);
point[0] = current_spline.Add(true, css);
css.transform.position = lastDotPosition + dirVector * 0.2f;
dot = point[0].transform;
dot.tag = "Track";
}

second = false;
secondDot = newDotPosition;
hideButtons.SetActive(true);
cutButton.SetActive(true);
}

AllowedDraw();
lastHeight = currentHeight;
noClick.SetActive(true);
lastDirVector = dirVector;
lastDotPosition = newDotPosition;
pointsLinkedList.AddLast(newDotPosition);
toggleLinkedList.AddLast(currentToggle);
heightsLinkedList.AddLast(currentHeight);
distancesStack.Push(cur_Distance);
dirVectorsStack.Push(dirVector);
cuttedPointStack.Push(wasCut);
lastPointExists = true;
wasCut = false; //important here
undoCut = false; //important here
}


This is the code for the CurvyMeshPath creation:


Code:
void CreateMeshBuilder()
{
meshBuilder = SplinePathMeshBuilder.Create();
meshBuilder.tag = "MeshTrack";
meshBuilder.name = "CurvyMeshPath";
meshBuilder.Spline = current_spline;
meshBuilder.UV = SplinePathMeshBuilder.MeshUV.Absolute;
meshBuilder.CapShape = SplinePathMeshBuilder.MeshCapShape.Rectangle;
meshBuilder.Extrusion = SplinePathMeshBuilder.MeshExtrusion.FixedDistance;
meshBuilder.ExtrusionParameter = 1;
meshBuilder.CapHeight = 0.1f;
meshBuilder.CapWidth = 2;
meshBuilder.GetComponent<MeshRenderer>;().material = roadMat;
}

I currently can't show the CurvyMeshPath in the inspector, since every time I click on the object Unity simply crashes from unknown reason, I'll check it later and will post an image, if you need it.
 
Reply


Messages In This Thread
Bug in Spline makes unity freeze - by FritsLyn - 08-15-2013, 09:00 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Information New free asset: Converter For Unity Splines _Aka_ 5 19 04-25-2024, 11:11 AM
Last Post: _Aka_
  Curvy Line Renderer for UI Spline? gekido 3 6 04-04-2024, 12:56 PM
Last Post: _Aka_
  Get position of all control points for a spline gekido 1 6 03-28-2024, 10:08 PM
Last Post: _Aka_
Bug Changing spline connection in inspector causes splines to revert to defaults lacota 3 6 03-18-2024, 07:55 PM
Last Post: _Aka_

Forum Jump: