حدود شش سال پیش یه ویدئو در یوتیوب آپلود کردم که نحوهی ساخت مارپیچ کروی رو در مایا نشون میداد. همون موقع یه سکرپیت ساده به زبان MEL نوشتم که این کار رو ساده کنه ولی نشد تکمیلش کنم تا امروز اتفاقی پیداش کردم و با کمک یه ابزار AI تکمیلش کردم.
// MEL Script to Create a Spherical Helix Curve in Autodesk Maya
// Parameters
float $radius = 5.0;
int $turns = 10;
int $segments = 100;
float $heightScale = 1.0;
// Create an empty array to store the points
float $points[];
// Generate the points for the spherical helix
for ($i = 0; $i < $segments; $i++) {
float $angle = 2 * 3.14159265 * $turns * ($i / float($segments - 1));
float $phi = $angle;
float $theta = 3.14159265 * ($i / float($segments - 1));
float $x = $radius * sin($theta) * cos($phi);
float $y = $radius * sin($theta) * sin($phi);
float $z = $radius * cos($theta) * $heightScale;
// Append the point to the array
$points[size($points)] = $x;
$points[size($points)] = $y;
$points[size($points)] = $z;
}
// Create the curve using the points
string $curve = `curve -d 3 -p $points[0] $points[1] $points[2]`;
for ($i = 1; $i < size($points) / 3; $i++) {
curve -a -p $points[$i * 3] $points[$i * 3 + 1] $points[$i * 3 + 2] $curve;
}
// Optionally, you can rename the curve
rename $curve "sphericalHelixCurve";e