Notifications
Clear all

[Closed] Get vertices in local coordsys

I want to extract vertices for a geometry in local coordsys

I have created a box with dimensions [2,2,2], centered its pivot point to its center and moved its position to [5,5,5].

I run the following code:

in coordsys local
(
tmesh = $.mesh
num_verts = tmesh.numverts

for i = 1 to num_verts do
(
v = getVert tmesh i
format “%
” v
)
)

The result is:

[-1,-1,0]
[1,-1,0]
[-1,1,0]
[1,1,0]
[-1,-1,2]
[1,-1,2]
[-1,1,2]
[1,1,2]

It is not centered (which I would expect). That tells me that the vertices are not in local coordsys. I have tried with an imported obj file, it gives me a similar result. What am I doing wrong/how can I fix it?

1 Reply
1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

you got points in local object coordinate system. to transfer them to node local you have to multiply points by node objecttransform and node inverse transform.
if you reset xform for your node, the way that you got points will give you points in node local coordinate system.