Introduction to Maya - Modeling Fundamentals Vol 2
This course will look in the fundamentals of modeling in Maya with an emphasis on creating good topology. It's aimed at people that have some modeling experience in Maya but are having trouble with complex objects.
# 1 27-12-2008 , 08:55 PM
Registered User
Join Date: Apr 2006
Posts: 26

constraining object to midpoint

Hey,

I have two objects which have aim constraints so they point towards each other and another one in the middle which does the same, however, i want this object to always be in at the midpoint of the first two objects as they move apart.

Thanks,
ben

# 2 28-12-2008 , 07:34 AM
halfloaf's Avatar
Lifetime Member
Join Date: Mar 2008
Location: Bristol, UK.
Posts: 191

Constraints

Hiya,

If I understand you correctly, the best thing to do to get the centre object to always be in the middle of the outer objects would be to create an expression.

Something along the lines where;

Object Left = "object_L"
Object Right = "object_R"
Object Centre = "object_C"

These are just descriptors...your expression would be...

object_C.tx=(object_L.tx + object_R.tx)/2;
object_C.ty=(object_L.ty + object_R.ty)/2;
object_C.tz=(object_L.tz + object_R.tz)/2;

What you're doing is telling object_C (your centre object) to inherit the average value of the translate values (tx, ty & tz) of the left and right objects.

Hope that helps!

-Jacques.


Poly-pushing on a '96 SGI O2
# 3 28-12-2008 , 10:41 AM
Registered User
Join Date: Apr 2006
Posts: 26
Hi, thanks for your help but im very new to maya- how would i enter this command?

Thanks.
Ben

# 4 28-12-2008 , 02:37 PM
halfloaf's Avatar
Lifetime Member
Join Date: Mar 2008
Location: Bristol, UK.
Posts: 191

Expression editor

Hiya,

No probs. You need to go to "Window->Animation Editors->Expression Editor"

Next, give the expression a name in the "Expression Name" field and click "New Expression"

Type in (or copy an paste) the expression in the "Expression" box...and click "Create"

You need to change the "Object_L" etc. for whatever your object is called. So, if you have say two spaceships called "ship1" and "ship2" with a planet in the middle, your first part of the expression would look something like...

planet.tx=(ship1.tx + ship2.tx)/2;

same goes for translate y

planet.ty=(ship1.ty + ship2.ty)/2;

Move one of the outside objects and your centre object will more with it.

I've attached a snapshot.

-Jacques


Poly-pushing on a '96 SGI O2

Last edited by halfloaf; 28-12-2008 at 02:39 PM.
# 5 28-12-2008 , 02:39 PM
halfloaf's Avatar
Lifetime Member
Join Date: Mar 2008
Location: Bristol, UK.
Posts: 191

Image

Image attached!

Attached Thumbnails

Poly-pushing on a '96 SGI O2
# 6 28-12-2008 , 03:16 PM
Registered User
Join Date: Apr 2006
Posts: 26
Thats Perfect - thanks sooo much!

user added image

# 7 28-12-2008 , 04:48 PM
Registered User
Join Date: Apr 2006
Posts: 26
Actually - Ive tried on another piece and the mid piece goes the opposite direction to what i want when i move one of the outer objects- ive looked in the channel box and its translate attributes are the opposite of everything else, how can i change this?

Thanks,
Ben

# 8 30-12-2008 , 08:47 AM
halfloaf's Avatar
Lifetime Member
Join Date: Mar 2008
Location: Bristol, UK.
Posts: 191

Hmm

Hmm,

Can you post an image? Also, you may find that you have frozen transformations on two of the objects and not the other? Are you working with global or local axis points...

I have a suspicion it's the freeze transformations problem...

delete the expression, freeze transformation on the objects and try creating the expression again.

-J


Poly-pushing on a '96 SGI O2
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