Notifications
Clear all

[Closed] Moving MNverts in local axis

hi folks I’m trying to move my selected verts inward as below.

move_verts

this is what I have at the moment to move in a world z axis but I’m a bit stuck to achieve the above .

	BitArray SelVerts;
	pmesh.getVertexSel(SelVerts);


	for (int i = 0; i < pmesh.numv; ++i)
	{
		if (SelVerts[i])
		{
			pmesh.v[i].p.z +=  10;
		}
	}
9 Replies

try to solve tasks like this (which doesn’t need deep knowledge of coding or math) using MaxScript.

It will save your and our time.

Hi denisT, its part of a modifer plugin i’m working on. do you mean using mxs in cpp?

Can you not solve this problem at all, or specifically for MNMesh?

You are working on the c++ sdk modifier, which involves solving much more complicated problems. Obviously, that is easier to solve simple tasks in a simpler environment (MaxScript in your case)

I cant solve it for MNmesh. I’m learning SDK and this is my second small plugin. This moving of verts or edges in MNmesh is one small problem of the tool. If its to hard to do then I’ll try to find a work around. Its easy to move in world space so I just assumed it it would be in local.

In maxscript I would getNormal and matrixFromNormal and loop through the vert.count.

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

so what’s stopping you from doing the same things in the SDK?
probably you need to know how to get MNMesh vertex normal, don’t you?
but you ask a question about how to move verts…

obviously, that to make a geometry plugin you must know how MNMesh (or Mesh) is organized.
so, what is your question? what does block you?

did you look at GetVertexNormal method of MNMesh class?

but if you really need matrixFromNormal is better to know by playing with MXS

thanks denisT, it was really simple

	for (int i = 0; i < pmesh.numv; ++i)
	{
		//pmesh.GetVertexSpace(i, tm);

		if (SelVerts[i])
		{
			
			Point3 Norm = pmesh.GetVertexNormal(i);
			pmesh.v[i].p -= Norm * 2;
		}
	}

see? just need to ask the right question

PS. you probably have to normalize vertex normal …

thanks buddy, appreciated. Back on track