Notifications
Clear all

[Closed] .pivot or .pos for TriMesh resulting from SnapshotAsMesh

I think I may be wrong, but my previous post was to eliminate the need for me to establish pivot point helpers for my objects that I’m trying to export. I have to rotate the objects around the origin, which I am now doing using the about context.

In the past, each object had a pivot of 0,0,0 and to tell the exporter where the pivot of each piece is supposed to be I used point helpers…clumsy, but it worked…and now I want to get away from that.

So I’m rotating and scaling snapshotasmesh trimesh nodes of my object so the original mesh stays unaltered in max. Basically the export operation takes place on a snapshot in memory, which is great…

However, I seem to be unable to retrieve the .pos or .pivot point of my trimesh node that results from the snapshotasmesh.

In the past I called for the .pivot.x property of the point helper AFTER it was scaled/rotated…now I’m trying to get the same property from my trimesh, but it says the property doesn’t exist.

how can I get the pivotpoint of the now scaled/rotated resulting trimesh?

4 Replies

Hi Robbie,
snapshotAsMesh doesn’t return a node, but only the “world state of node as a <mesh> value” which means something like the pure topology, referring to an origin of [0,0,0].

.pivot, as well as .position and .transform are node properties, so you cannot query them on a TriMesh. You should use a simple snapshot, which creates a node (Editable Mesh) and have all properties you need. If you want, you can hide it or use “with redraw off” context to speed up your transformations, then delete it after export.

  • Enrico

ahhh ok…so snapshot versus snapshotasmesh will give me somethign I can work with, but I’ll have to delete it when I’m done with it? I currently don’t have to delete the snapshotasmesh trimesh.

Wow, yeah that gave me lots of success!

I’m doing:

tmesh = snapshot allobj[i]

and at the end I just delete tmesh

That’s the way I’d do it too. About snapshotAsMesh, I’m not sure if it’s only a pointer to the world state node mesh, or if it’s an actual copy in memory. If you need to use it, when finished be sure to set its variable to undefined and eventually call the garbage collector, I’m afraid it could float indefinitely in memory.

  • Enrico