|01-17-2008, 09:02 PM||#1|
Join Date: Aug 2004
world point position from poly uv's
Is it possible to get the point position from a uv coord on a poly?
You can do this on a nurbs surface
// Result: -0.811743 0.796932 -0.583178 //
any help appreciated
(also posted in dynamics forum)
|01-17-2008, 10:39 PM||#3|
Join Date: Aug 2004
using the .map coords doesn't give me what I want...
it does not interpolate across the uv space as the nurbs .uv's do,
and how do I know which uv coord map[$n] corresponds to?
I have particles with goalU and goalV if my goal object was nurbs I could easily
fing out where the particles were being attracted to by
float $pos=`pointPosition nurbs.uv[goalU][goalV]`;
unfortunately I am not using nurbs so I want to find a way of doing the same thing with
a poly object
|01-21-2008, 02:27 AM||#5|
CG talk crawler...portfolio
3D Tech Artist
just a quick try i did - with a sphere which is parented to world..
xform -q -ws -t pSphere1.map - returns a value which does give you usable values..
but when the pSphere is under a group, now the command is NOT returning world space values ???
sory this might be fully usable but just wanted to try..
|| Loka samastaa sukhino bhavantu ||
|01-21-2008, 09:21 PM||#6|
Character Simulation Technical Director
Blue Sky Studios
if I understand correctly, you're trying to find a point ANYWHERE on the poly object. I've made a script in the past that did this sorta (it was for a company so I can't post the script). Buttttt, the script involved some math to find an exact location on a plane, the math is basic algebraic math. Basically finding locations between verts based on percentages.
is/of * x/100 = %
soo basically, I'd find the 4 vert locations of the face the object is currently in. And if you take two vectors of two verts in that face, and subtract each other, you'll have a difference that you can move the object through ----
so the possible movement area between these two verts is
<<(x2-x1), (y2-y1), (z2-z1)>>
<<2,5,3>> --- This is your "Of" value in the equation I wrote above.
so to pull the percentage, this would be an already existing attribute on the particles themself of object itself. For particles, just make another general per particle array.
but lets say the object is 70 % between both of those verts
Soo for this --- is/of * x/100 = %
You'd look for the "Is"
And just plug in your vector you found
X/2 * 70/100 = 1.4
X/5 * 70/100 = 3.5
X/3 * 70/100 = 2.1
So, the vector 70% between point 1 and point 2 is -
<<1.4, 3.5, 2.1>>
You'd write these in scripting like this --
$Is = Of * x /100;
float $X = 2*70 / 100;
Then add the found values for point 1 -
And just do it for your x y and z, but this is a bit of work. SOOOO I dunno if you feel like writing out the math for this.
Seeing how polygon objects have UVs, and are set points in space, it's hardder to find specific points on the object. Nurbs are all math, so the mesh uses the logitude and latitude as U and V values, but you know that.
Here is something I wrote up real fast, but pretty much all it does is find the selected UV on the poly object's UV Map and converts it to a vert and finds the point in space of the vert.
Thats the best I can do without writing a bit larger of a code for you.
But, if you are doing this for a particle system, it's easy to just run through the verts as a goal value, and the particle will like float to the next point, you just need to lower the goal weight. That way the particles will move to the next particle. You can find the next vert to move to by finding the connected edges to the vert and find the verts on one of those edges and the vert that you arn't currently at would be the only other vert listed.
DAMN, that was long
Last edited by trancor : 01-22-2008 at 02:37 AM.
|01-21-2008, 11:09 PM||#8|
Join Date: Sep 2003
Thread automatically closed
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
|Thread Closed share thread|
|Thread Tools||Search this Thread|