PDA

View Full Version : Question: Move an object inside a limited area.


bozobozoca
03-27-2008, 04:31 PM
Hello everybody. It's my first post here.

I have a little question about limit information.
I'm trying to maintain a cube inside a triangle, but I getting anywere using the limit information.

http://www.bozobozoca.com/up/forum/limit_information01.jpg
http://www.bozobozoca.com/up/forum/limit_information02.jpg

Is there another way to say to that cube to stay inside a triangle? (or inside another form that isn't a cube?)
Mel script are welcome. heaehaeh
Once, I saw this in na GUI video on youtube, so in some way this is possible. eahaehaeh

Thank everybody for the attention.
* I tried to find some post about this, but dind't get sucess.
**sorry about my poor english
Have a nice day.

sj_bee
03-28-2008, 01:05 PM
What you are trying to do is not trivial, it will require some maths and programming, and it might not be worth weighting down the scene with complex calculations like this.

You will have to edit the limit infomation for the cube on the fly, as it moves around inside the traingle, and this might be quite hard to get stable.

Off the top of my head I would suggest using scriptJobs which run whenever the translate attribute of of the cube is changed. These could set the translate limits depending on the cube's position.

You could calculate the limits using Trigonometry
http://www.clarku.edu/~djoyce/trig/ (http://www.clarku.edu/%7Edjoyce/trig/)

You might also find this useful
http://www.blackpawn.com/texts/pointinpoly/default.html

sj_bee
03-28-2008, 01:07 PM
What you are trying to do is not trivial, it will require some maths and programming, and it might not be worth weighting down the scene with complex calculations like this.

You will have to edit the limit infomation for the cube on the fly, as it moves around inside the traingle, and this might be quite hard to get stable.

Off the top of my head I would suggest using scriptJobs which run whenever the translate attribute of of the cube is changed. These could set the translate limits depending on the cube's position.

You could calculate the limits using Trigonometry
http://www.clarku.edu/~djoyce/trig/

You might also find this useful
http://www.blackpawn.com/texts/pointinpoly/default.html

nilslerin
03-29-2008, 09:03 PM
For some reason not many know of the "geometry" constraint and even less use this simple but very powerfull constraint.

What you are trying to do can very easily be done with a geometry constraint, select the cube and then the triangle and go to constraints->geometry consraint. The triangle can of course not be just a curve, but use a nurbs och poly-surface instead.

Cheers,
Nils

bozobozoca
03-30-2008, 01:02 AM
sj_bee - thanks for the answer, those links were very good. When I start my studies in MEL script, it would be a great suport material.

koopatrooper - You are right. the geometry constraint is really powerfull. I play a lot with cv curves, and sculpt geometry tool and everything works great.

If someone gonna try with CV curve, make sure to become this cvs a polygon (with a face), or the geometry Constraint, will understand as "geometry" just the lines.

Thanks for the help.
have a nice day.

JamSession
03-31-2008, 10:54 PM
why limit it?

If it is for a facial GUI, then just create your set driven keys as you would for a square, just do it for a triangle.

Just set the limits like you would on a square, if you go out of the triangle it won't matter, I believe there was a clown rig on youtube (goosh's) and that is how he did it.

CGTalk Moderation
03-31-2008, 10:54 PM
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.