03-26-2024, 01:25 PM
Hi
You can connect multiple Variable Mix Shapes together to blend more than 2 shapes. This has the advantage of not needing to code, but it is not the easiest to use.
Your suggested solution would be indeed easier to use, but will need coding.
Your solution should not be difficult to implement. You basically will have to replace lerping between two values, as it is now in Variable Mis Shapes, with weighted sum of the values.
Don't let yourself affraid with lines looking like this
positionsArray[i].x = aPosition.x + ((shapeBPositionsList[i].x - aPosition.x) * interpolationTime);
positionsArray[i].y = aPosition.y + ((shapeBPositionsList[i].y - aPosition.y) * interpolationTime);
positionsArray[i].z = aPosition.z + ((shapeBPositionsList[i].z - aPosition.z) * interpolationTime);
These are simply lerping between aPosition and shapeBPositionsList[i], but written in a manner that consumes less CPU.
About the inputs, the module has 2 inputes,
[HideInInspector]
[InputSlotInfo(
typeof(CGShape),
Name = "Shape A"
)]
public CGModuleInputSlot InShapeA = new CGModuleInputSlot();
[HideInInspector]
[InputSlotInfo(
typeof(CGShape),
Name = "Shape B"
)]
public CGModuleInputSlot InShapeB = new CGModuleInputSlot();
In your case, you will need something like
[HideInInspector]
[InputSlotInfo(
typeof(CGShape),
Name = "Shapes",
Array = true
)]
public CGModuleInputSlot InShapes = new CGModuleInputSlot();
You would probably need another input which will be a list of weights.
I hope this helped.
Have a nice day.
You can connect multiple Variable Mix Shapes together to blend more than 2 shapes. This has the advantage of not needing to code, but it is not the easiest to use.
Your suggested solution would be indeed easier to use, but will need coding.
Your solution should not be difficult to implement. You basically will have to replace lerping between two values, as it is now in Variable Mis Shapes, with weighted sum of the values.
Don't let yourself affraid with lines looking like this
positionsArray[i].x = aPosition.x + ((shapeBPositionsList[i].x - aPosition.x) * interpolationTime);
positionsArray[i].y = aPosition.y + ((shapeBPositionsList[i].y - aPosition.y) * interpolationTime);
positionsArray[i].z = aPosition.z + ((shapeBPositionsList[i].z - aPosition.z) * interpolationTime);
These are simply lerping between aPosition and shapeBPositionsList[i], but written in a manner that consumes less CPU.
About the inputs, the module has 2 inputes,
[HideInInspector]
[InputSlotInfo(
typeof(CGShape),
Name = "Shape A"
)]
public CGModuleInputSlot InShapeA = new CGModuleInputSlot();
[HideInInspector]
[InputSlotInfo(
typeof(CGShape),
Name = "Shape B"
)]
public CGModuleInputSlot InShapeB = new CGModuleInputSlot();
In your case, you will need something like
[HideInInspector]
[InputSlotInfo(
typeof(CGShape),
Name = "Shapes",
Array = true
)]
public CGModuleInputSlot InShapes = new CGModuleInputSlot();
You would probably need another input which will be a list of weights.
I hope this helped.
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.