Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Force Mesh creation at runtime?
#3
This code does not work, unless, I put it into a co-routine with a 0.1f second wait.

Code:
   // Create the spline
   var GENERATOR = CurvyGenerator.Create();
   var SHAPE = Rails[0].CopyTo(GENERATOR);

   var PATH = GENERATOR.AddModule<InputSplinePath>();
   var EXTRUSION = GENERATOR.AddModule<BuildShapeExtrusion>();
   var VOLUME = GENERATOR.AddModule<BuildVolumeMesh>();
   VOLUME.SetMaterial(0, RailMaterials[1]);
   VOLUME.MaterialSetttings[0].KeepAspect = CGKeepAspectMode.ScaleU;
   var MESH = GENERATOR.AddModule<CreateMesh>();

   // Wire the Generator Parts
   PATH.OutputByName["Path"].LinkTo(EXTRUSION.InputByName["Path"]);
   SHAPE.OutputByName["Shape"].LinkTo(EXTRUSION.InputByName["Cross"]);
   EXTRUSION.OutputByName["Volume"].LinkTo(VOLUME.InputByName["Volume"]);
   VOLUME.OutputByName["VMesh"].LinkTo(MESH.InputByName["VMesh"]);

   // Create the spline
   PATH.Spline = CurvySpline.Create();

   GENERATOR.Initialize(true);

   // ... logic to add points to SPLINE

   GENERATOR.Refresh(true);
   var CREATED_MESH = MESH.SaveToScene(myGameObject.transform);

   // CREATED_MESH is null
Reply


Messages In This Thread
Force Mesh creation at runtime? - by Elenesski - 09-18-2016, 03:29 AM
RE: Force Mesh creation at runtime? - by Jake - 09-19-2016, 03:15 PM
RE: Force Mesh creation at runtime? - by Elenesski - 09-19-2016, 07:56 PM
RE: Force Mesh creation at runtime? - by Jake - 09-21-2016, 06:56 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Incorrect mesh alignment after extrusion on curved path Thinkurvy 10 21 04-17-2024, 10:57 AM
Last Post: _Aka_
  Set Volume to the Volume Controller at Runtime pako88 2 10 04-08-2024, 03:26 PM
Last Post: _Aka_
  Adjust radius of generated mesh via script? Shackman 1 4 03-26-2024, 01:12 PM
Last Post: _Aka_
  Avoiding runtime GC allocations on control point position change Ell223 8 18 02-24-2024, 10:43 AM
Last Post: _Aka_

Forum Jump: