maxscript…
“snapshotAsMesh object” gives you the current object completly collapsed.
bad thing is, the transform matrix is also applied, so all vertices are in world space.
get the vertices back into local space, you multiply every vertex with the inverse transformation matrix:
mesh = snapshotAsMesh obj
worldTransform = obj.transform
invWorldTransform = inverse worldTransform
for v = 1 to mesh.numverts do
(
vert=getVert mesh v
vert*=invWorldTransform -- daadaaa
WriteFloat f vert.x
WriteFloat f vert.y
WriteFloat f vert.z
)
for your normals you have to do the same, just multiply with the inverse world matrix. but only use rotation this time.
do not use obj.mesh directly to get object space vertex coordinates, or your script will become unbelivable slow…..