Simply Maya User Community

Simply Maya User Community (https://simplymaya.com/forum/index.php)
-   Maya Basics & Newbie Lounge (https://simplymaya.com/forum/forumdisplay.php?f=31)
-   -   getting a verts worldSpace coordinates (https://simplymaya.com/forum/showthread.php?t=34187)

Falott 25-06-2010 02:46 PM

getting a verts worldSpace coordinates
 
Didn´t know exactly where to post that issue, so here´s my terrible problem.

I desperately need to point constrain a locator to a vertex. the vert is part of a skinned geometry -> animated. while the vertex is now moving through space the locator should stick to it.

things I tried:

1)pointConstraint

select vertex + shiftSelect Locator
Animation > Constrain > Point

(creates a pointConstraint, but doesnt have any effect on the locator. locator stays where it is.)


2) geometryConstraint

select vertex + shiftSelect Locator
Animation > Constrain > Geometry

(create the geometryConstraint, but the locator is now floating over the geometry while it trying to maintain its original location in space)


idea:

outputCloth4.pnts[171].pntx";
outputCloth4.pnts[171].pnty";
outputCloth4.pnts[171].pntz";


my geometry is called collisionDress (because it will be animated with nCloth). my idea now was to feed the vertex xyz-coordinates into the locators xyz-coordinates. the problem but is, I will have to do this for multiple animations - ergo script it.

question:

how do I get worldspace coordinates from a vertex so I can plug its values into the locators XYZ translations?? because If I´d select the dress, go to component mode - select vertex - CVs[click to show] it always says 0 0 0 for all vertices for all translations - I guess thats local space...


is there any way to feed my locator with world space values from a vertex?

please help

Jay 25-06-2010 04:06 PM

Fallot I just asked about here at work to alot of very good guys. Now without giving you a script and plugin for this from work, there is a fairly simple process.

Attach a cluster to the vert then add the locator to the cluster. See how it goes, we did it here and its fine, you'll just have to figure it out in your hierachy.

cheers
J

Falott 25-06-2010 05:31 PM

cool, how could I have not thought about clusters...
I am sure that´ll work just fine

today you saved my life jay!


thx a ton m8!

bullet1968 26-06-2010 02:38 AM

here mate,

found this thread on another site..see avace reply. I just tried it and it displays the co-ords.

Hope the help was useful.


Quote: Windows => General Editors => Component Editor

and then select the Polygons tab

It will list the XYZ of the vertices selected. End quote.


http://www.3dbuzz.com/vbforum/showth...coordinates...

Falott 28-06-2010 08:06 AM

ok, funny thing. either I missunderstand something here or I just dont get it..

the cluster returns exactly the same problem like with any other transform node. I can constrain the vertex to the cluster of course, but I cant constrain the Cluster to the vertex.

now for dummies. how did you put up the connection exactly from vertex to cluster?

select vertex - shiftSelect cluster - point/geometry constrain? because that doesn´t work.

I also tried to make use of the connection editor -
mesh.pntsXYZ > cluster.translateXYZ
this again sets my cluster to 0 0 0 at each frame of the animation.

I tried expressions (which works the same like connectionEditor I guess)

cluster1Handle.translateX = outputCloth1.pnts[159].pntx
cluster1Handle.translateY = outputCloth1.pnts[159].pnty
cluster1Handle.translateZ = outputCloth1.pnts[159].pntz


weird thing is if I select a vert in the componentEditor like bullet suggested and move the vertex script editor returns

move -1779 213.435852 -2118.266846 outputCloth1.vtx[159];

which makes me think there is no difference between local and worldspace.


I guess I just need an expression like this

cluster1Handle.translateX = outputCloth1.pnts[159].pntx(world)


but how?

Falott 28-06-2010 08:19 AM

here´s another idea

float $vtxPosA1[1] = `xform -q -ws -t outputCloth1.vtx[159]`;
print $vtxPosA1;

-1779.823486
213.435852
-2118.266846


this seems to work fine



question:

how do I feed those values into a transform node with the help of an expression?

transformNode.translateX = $vtxPosA1; ??
transformNode.translateY = $vtxPosA1; ??
transformNode.translateZ = $vtxPosA1; ??



_____edit_____
oh man...

i just realised that I can´t use $scripts because I need an update at each frame of the animation.

so how do I feed transformNode with an expression?
there must be a very simple line of mel code for it. :(

Falott 28-06-2010 08:54 AM

guess I just found the answer here ->

http://home.comcast.net/~tstoeger/ti...onstaints.html

method 2

Falott 02-07-2010 01:48 PM

1 Attachment(s)
still not quite what I need. another problem showed up during the process.


the last step which made my rig work was an expression in the locators.translation


float $vertA1[] = `xform -q -t -ws outputDress.vtx[159]`;
AimA1.translateX = $vertA1[0];
AimA1.translateY = $vertA1[1];
AimA1.translateZ = $vertA1[2];


that made them stick to surface while it animated.

next step was laying my dress rig on top of that structure by feeding spine rotation values from mocap_spines to dress_spines and let the dressBones (selected one in the pic) aim towards the vertex constrained AimLocators.

the goddamn thing now really moves finally. the bones follow the cloth simulation.

BUT

for all 6 jointChains (2 bones each) I would now have to make corrections to the offsetX rotation values. which would be a tedious work for 7 times 4000 frame walking animations.


SOLUTION (how I have in mind..)


is there a way to connect the

"dressBoneB1_aimConstraint1.offsetX"

with the help of of a normal or geometry similar constraint so the bone (Xrotation) follows the flow of the surface below?

I guess all that sounds pretty confusing, and I am sorry for my lack of explaining things carefully enough.

thing is - if that last step finally works, I could bake a cloth simulation to a boneanimated dress for exporting it to a realtime application with some mouse clicks

I´d be happy to provide further informations if anyone has an idea.

thx!

Falott 02-07-2010 02:41 PM

ok, dont waste your time. I just broke the connection of the ainConstrain in X. still needs a little bit of tweaking but compared to what I hade before it should be a piece of cake.

thx for your helps

NextDesign 05-07-2010 12:25 AM

You can use the xform command.

Select the object/component. Then type "xform -q -ws -t" to get the selected objects/component's worldspace position.


All times are GMT. The time now is 05:20 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Simply Maya 2018