User:Toxsikkilla

From Legacy Roblox Wiki
Jump to navigationJump to search

How to make meshes

This article will explain how to make a Mesh, and import it into ROBLOX. Some parts may confuse you, so read it carefully.

IMPORTANT NOTE: ROBLOX Studio can easily crash while putting meshes in, SO SAVE FREQUENTLY.

Requirements

Anim8or, To get this go to This Site

ROBLOX Studio, and a vast knowledge of its functions.

Part One

copy this into Notepad...

/*
  Description: Add this to your Anim8or scripts directory and start Anim8or.
*/


#plugin("object", "export", "Roblox Mesh", ".mesh");
#file($output, "text");
#return($result);

file $output;
int $result;
object $obj;
shape $shape, $shapes[1], $childShapes[1];
tridata $data;
material $mat;
int $numFaces;
point3 $point, $normal, $color;
point2 $uv;
int $i;
int $j;
int $index, $mIndex;
int $count;
float $gCol;
string $nm;
string $newName;
float4x4 $tMatrix;

$nm = $output.GetRoot();

$obj = project.curObject;
$output.print("version 1.00\n");
$obj.GetShapes($childShapes);
$shapes.size = 0;
while($childShapes.size > 0)
{
    $shapes.push($childShapes.pop());
}
while($shapes.size > 0)
{
    	$shape = $shapes.pop();
    	$shape = $shape.ConvertToMesh();
	$data = $shape.GetTriangleData();
       	$numFaces = $data.GetNumTriangles();
	$tMatrix = $shape.GetGlobalTransform();
	$output.print("%d\n",$numFaces);
	for $i = 0 to $numFaces - 1 do {
		for $j = 0 to 2 step 1 do {
			$index = $data.GetIndex(($i*3)+$j);
                    	$point = $data.GetPoint($index);
            	    	$point = $tMatrix.Project($point);
                    	$normal = $data.GetNormal($index);
                    	$uv = $data.GetTexCoord($index);
			$output.print("[%.6g, %.6g, %.6g]", $point.x, $point.y, $point.z);
			$output.print("[%.5f, %.5f, %.5f]", $normal.x, $normal.y, $normal.z);
			$output.print("[%.5f, %.5f, 0]", $uv.x, $uv.y);
                }
	}
}


$result = 1;

Then go to Save As-> All Files-> (type)ExportScript.a8s and save it in the C:\ Drive.

Then, in Anim8or, go to "File" --> "Configure", the window looks like this

Check the box that says "Preload Scripts", and change the Box with "Scripts" to C:\, or where the .a8s is saved

Press OK, then quit Anim8or, then open it again. Now you can go into "Object" --> "Export" and change the format to "ROBLOX .mesh file"

Part Two

First, you must make the mesh, you can use ANY program you wish, as long as it can export as a .3ds file.

Export the mesh into .3ds format.

Then open the .3ds in Anim8or, and then Export it as a .mesh file at C:\

Then open ROBLOX Studio, Create a Part with a SpecialMesh inside, and change the mesh to FileMesh (Default "Head")

After that, type C:\nameoffile.mesh... WARNING! TYPE ALL IN ONE GO OR IT WILL CRASH! I suggest that you SAVE before doing this.

And, wala! Your mesh is in ROBLOX and ready for action!

Conclusion

Please put any comments, complaints, rants, etc. In the DISCUSSION PAGE...

---Article by Toxsikkilla---