Can you restrict movement?

Moho allows users to write new tools and plugins. Discuss scripting ideas and problems here.

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
GardenGuy
Posts: 45
Joined: Thu Jan 17, 2008 3:23 pm
Location: Buffalo, NY

Can you restrict movement?

Post by GardenGuy »

I apologize if there is already some thing like this... But I am looking to restrict my movement when doing several tasks to only moving straight right and left or straight up and down, and even possibly in a perfect circle. (in relation to where I activate the restriction control)

This could be while I'm drawing a path for and object in a layer and want the path to go straight up and down or moving a whole layer from right to left in a straight line. It could also be while I am drawing on a vector layer.

Is it possible to write a script that could make an icon (a toggle type) in the menu that could do this?

Maybe one that when it's pressed would restrict your movements left right and another that restricts up down and pie in the sky to let you draw only in perfect circles (no matter how many points you are laying down for an object, or how many perfect circles you want your layer to move in.

Thanks for ALL your help
(Thanks especially Vern for sharing all your indepth knowledge on using AS. (Bones, masking and scripts especially) It really made my learning curve a whole lot easier.)
User avatar
heyvern
Posts: 7035
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

Can you expand on your explanation a little more? I'm having trouble getting the idea. Would this be for animation or drawing? Or both?

A perfect circle can be drawn using the circle tool and split points if needed to add points. Constraining to a straight line could be done with key frames for animation, or the "shift" key when drawing or moving points or bones.

You could translate an object in a perfect circle using two bones one with a rotation constraint, think of the cars on a ferris wheel.

Some more info is needed for me at least.

-vern
GardenGuy
Posts: 45
Joined: Thu Jan 17, 2008 3:23 pm
Location: Buffalo, NY

Post by GardenGuy »

In particular I'm looking for a function in both drawing -objects(a selection of points)/or single points AND in moving layers, bones, etc. around.

Basically I want the mouse movement I'm doing to be constrained so that I only move at a direct right angle (say I'm at 0 on the y scale and 10 on the x, I want to keep the mouse moving only at 0 on the y scale while I move along the x scale (this would be the one of these function keys) The opposite would be the other key constraining the x to stay at 10 while I move up and down along the Y. (If I take this further I would want to have an ability to enter the angle I want to contrain to so I could do 45 degrees, 30 degrees, etc. )

For a circle, it would be more complicated. While drawing I select the circle shape and it stays a circle with 4 points but after that if I add points my only option (at least in my Standard version) is the Add Points and when I do I have to adjust each point with the point curvature tool to get back my perfect circle. I'm looking for something where I can say I want a perfect circle created with 20 points (for example) to begin with.

For the circle use in moving things around....I've rotated things in my animations already but what I'm looking for is something a little different. I want to to define how big a circle I want to move in and as I move the mouse, the layer (for example) moves in a perfect circle around a mid point (which may have to be selected after selecting the cirlce move and size). So lets say you have the center point of the screen as that mid-point. Where ever your layer is currently,as you move the mouse it will move in a circle around that center mid-point as you move your mouse. (And I'm not talking rotate upside down, I'm talking the layer would remain at the angle it started and move around that point always at the same angle)

I hope this helps clarify what I'm thinking of...
User avatar
heyvern
Posts: 7035
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

Currently you can constrain any motion using the shift key when dragging. It only constraints at 90 degrees though. Not sure if that is what you meant. As far as scripting for different angle constraints... I've always wanted that too. It should be possible. I could add a text field option for that in the tool properties. I will look into it when I get a chance.

I'm still having trouble understanding the "circular" constraining. You want a layer or object to rotate around a center circle but stay oriented vertically or at whatever angle is defined? You can do that already using bones and constraints. For instance a layer can be bound to a bone. This bone would be a child of the rotation bone. The bone controlling the layer would have a rotation constraint to "reverse" the rotation.

In this sample a bone rotates and scales creating a spiral motion. The bound layer stays at the same orientation:

http://www.lowrestv.com/moho_stuff/foru ... ation.anme

If this is NOT what you intended let me know. Sometimes drawing a picture or even animating a "simulation" might help.

-vern
GardenGuy
Posts: 45
Joined: Thu Jan 17, 2008 3:23 pm
Location: Buffalo, NY

Post by GardenGuy »

Thanks Vern. I'll check that circle solution out when I get home. (Not sure if it's what I'm trying to describe)

I'll scare up an example or draw a picture what I'm thinking of. I"m just trying to find a legitimate place to post my files to share (or get my brother to convert my webpage to host ftp)
GardenGuy
Posts: 45
Joined: Thu Jan 17, 2008 3:23 pm
Location: Buffalo, NY

Post by GardenGuy »

The circle rotation did it! Thanks Vern! It was the additional bone on the end that kept the layer oriented

And, embarassingly, the handy Shift Key was all I needed for the right angles. When I went back and tried that while drawing it made me realize that early on in my learning process I was thrown off by the curvature function which is on in default- thinking "Well that's not a right angle." When I tried to draw two connected lines. I never went back to try the shift key after learning that part of the program.

How ironic that I even put in my newbie tips and tricks how useful the Shift key is....I can't wait to find out what else it does.... It does CAPITAL LETTERS? How cool.... :oops:
User avatar
heyvern
Posts: 7035
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

I thought it sounded like it might be that simple... but I wasn't sure and wanted to make sure. That was probably why I had just a tiny bit of trouble understanding. ;)

Glad it worked out for you!

-vern
GardenGuy
Posts: 45
Joined: Thu Jan 17, 2008 3:23 pm
Location: Buffalo, NY

Post by GardenGuy »

Vern - If you ever get the interest in creating that option to restrict to other than 90 degrees (ie. enter then degrees in a text field) let us know!
Genete
Posts: 3483
Joined: Tue Oct 17, 2006 3:27 pm
Location: España / Spain

Post by Genete »

Post Reply