Maya 2020 fundamentals - modelling the real world
Get halfway through a model and find it's an unworkable mess? Can't add edge loops where you need them? Can't subdivide a mesh properly? If any of this sounds familiar check this course out.
# 1 02-11-2006 , 06:41 AM
Registered User
Join Date: Oct 2006
Posts: 10

help!!! how to define the position of one object in relation with a nurbs surface

I have several boxes and I need to get the Yvalue of one nurbs surface in the medium point of each box. Someone can help in how to script,.. how to read the position of my box in relation with that surface, to allow the program to read the value in that specific point of the surface (where my box is)

$ac = getAttr ("accesibility.cv["+$p+"]["+$i+"].yValue")

$ac is the Y value of the surface
$p is the position of the box (that is what I need to know how to define in relation with the surface)
$i is the position of the box in the other direction (that is working)


Thank you very much!!

# 2 03-11-2006 , 06:33 AM
Dann's Avatar
Registered User
Join Date: Feb 2003
Location: Los Angeles
Posts: 695
This is a very confusing post. Let me try and understand. You have a box and a Nurbs object, and you're trying to find the center point between the 2 objects? Maybe you're trying to find the center point of the box? Or maybe you're just trying to find the local coordinates or each cv?

Please clarify.

# 3 03-11-2006 , 06:57 AM
Registered User
Join Date: Oct 2006
Posts: 10
Ok,.. I'm sorry if I haven't been clear enough,.. I'm not used to explain this kind of things,...

I'll post a picture and then it will be more clear, I also will try to explain it better now.

I have several boxes(of different sizes) one next to the other one in the Z direction but these boxes are moving in the X direction, so they are not always touching one to another one.

The behaviour of these boxes is related with the surface called accessibility. And the program is reading a property of this nurbs surface that is $ac (the Yvalue of this surface in a specific point.)

The problem that I'm having is to relate the position of the shop with the corresponding value of $ac. Because I need to get the value of the $ac, from the medium point of the box, each time that the box moves.

So, what I need is know how to define the position of the box in relation with the surface.

pd. maybe it is easier to do it in another way,..calculating the distance between the box and the surface that is under it,.. but I don't know neither how to do it,...
So please, if you know some way to do it,.. it will be welcome,..

I hope it is clear now,... if not,.. I'll try it again,..
Thank you!!!

Attached Thumbnails
# 4 03-11-2006 , 10:03 PM
Alan's Avatar
Moderator
Join Date: Oct 2002
Location: London, UK
Posts: 2,800
Ok I still don't quite understand what you need to do but because you are using a Nurbs Surface that is UV 0-1 you can use the pointOnSurface command e.g.

float $pos[] = `pointOnSurface -u $u -v $v`;

this will give you the position in world space of the point at that UV coordinate. You can then just get the Y component e.g. $pos[1] and use that. So if you now base you shop's movement on the UV parametres you can move objects around the surface very easily and you can always query their Y value.

user added image
A


Technical Director - Framestore

Currently working on: Your Highness

IMDB
# 5 03-11-2006 , 10:22 PM
Registered User
Join Date: Oct 2006
Posts: 10
Thank you very much for your reply!!!

But I'm not sure if it is also useful if the shops are not moving in the surface accessibility,..

The boxes are never moving in the Y direction, but they want to know the distance from them to the accessibitity surface in the Y direction.

Is it ok then? should I use

float $pos[] = `pointOnSurface -u $u -v $v`;

to know the position of the box in UV coordenates?

Thank you again,.. it is very useful for me,.. I'm very happy to get some answer :-)
(I need to solve this before friday,...if not my teachers will kill me, because I'm doing architecture, and they are not interested with that,.. they feel that I'm loosing my time, But I think artificial intelligent can be very useful for architecture!!!!)

# 6 03-11-2006 , 10:29 PM
Alan's Avatar
Moderator
Join Date: Oct 2002
Location: London, UK
Posts: 2,800
if you want to get the distance from the pivot of the box to the point on the accessibilty surface then you need to subtract the two y components.
remember the thing I gave you gives you a World Space position NOT a UV position (you must supply UV coordinates to get teh world space position back)

float $accessibiltyHeight[] = `pointOnSurface -u $u -v $v`;
float $boxPos[] = `xform -q -ws -t $myBox`;

float $yHeight = $boxPos[1] - $accessibiltyHeight[1];

And don't confuse maya with Artificial Intelligence... they're really not the same thing at all...

user added image
A


Technical Director - Framestore

Currently working on: Your Highness

IMDB
# 7 03-11-2006 , 10:38 PM
Registered User
Join Date: Oct 2006
Posts: 10

thanks!!

I think now it is clear, Ill try to introduce it in the program!

Thank you very much!!!

# 8 04-11-2006 , 01:34 AM
Dann's Avatar
Registered User
Join Date: Feb 2003
Location: Los Angeles
Posts: 695
elegant solution Pure.

Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads