Page 1 of 1
Midpoint point script on bone position
Posted: Fri Jun 25, 2010 11:12 am
by hothead
midpoint scrip
Can any one write a script to tell the midpoint of the selected point.
this is what you an do: since AS is like a graph sheet use the same principle you would use went you where in school using the mipoint formula (x1+x2)(y1+y2) divide both x and y answer by 2 to get the X,Y position.
Bone script
for this script you most be able to select a point or input the position of the point. because bone on point dont share the same x,y position the script should transulate the bone position to match with the point position
Posted: Fri Jun 25, 2010 12:41 pm
by ponysmasher
I tried quickly making a script that gives you the midpoint of two selected points:
http://www.dauid.com/tools/scripts/ds_midpoint.zip
I think it should work. If more than two points are selected then the script will just use the first two points that it finds.
Posted: Fri Jun 25, 2010 1:09 pm
by Paul Mesken
I've never done any lua programming but you could also have running totals for x and y in your for loop (just sum all the x's and y's in some local variables like XTotal and YTotal) and then divide by mesh::CountPoints. That way it will work for any number of points (except 0, of course).
Posted: Fri Jun 25, 2010 1:52 pm
by hothead
ponysmasher wrote:I tried quickly making a script that gives you the midpoint of two selected points:
http://www.dauid.com/tools/scripts/ds_midpoint.zip
I think it should work. If more than two points are selected then the script will just use the first two points that it finds.
ponysmasher ARE YOU FREAKING KIDDING ME

how the hell you get a super computer the fit inside of your brain am speechless you did it you is a freaking computer everyone ponysmasher is the BEST HERE i cant stop thank you you rule man.
I GOT THE IDEAS YOU HAVE THE SOLUTION you rule thank you....
ponysmasher can you now try the bone one to tell a bone to go exact where you tell it to go simple give the bone the x,y position of a POINT position the well than recalculate its position to align up with the point x,y position. but first you'll need to find out how the bone and point x,y position work.
in other words try to get a bone snap to a point someone said that ASP is not that advance to do things like that but i know it can do it as AS is like a graph sheet you you need is some kind of formula to caculate it position
Posted: Fri Jun 25, 2010 1:54 pm
by hothead
ponysmasher wrote:I tried quickly making a script that gives you the midpoint of two selected points:
http://www.dauid.com/tools/scripts/ds_midpoint.zip
I think it should work. If more than two points are selected then the script will just use the first two points that it finds.
ponysmasher THANK YOU AGAIN YOU THE BEST
Posted: Fri Jun 25, 2010 2:01 pm
by Genete
midpoint scrip
Can any one write a script to tell the midpoint of the selected point.
this is what you an do: since AS is like a graph sheet use the same principle you would use went you where in school using the mipoint formula (x1+x2)(y1+y2) divide both x and y answer by 2 to get the X,Y position.
If you just want to know the x,y mid point number values I have another solution without need to run any script.
Select the two points with the Select Points tool. Then select the Translate points tool the input fields (x,y) in the tool options bar gives you the geometrical center of the selected points (which in the case of two points coincides with the midpoint)
I'm talking by memory and maybe it differs from the new version. I cannot check it in this computer now.
-G
Posted: Fri Jun 25, 2010 2:19 pm
by hothead
Genete wrote:midpoint scrip
Can any one write a script to tell the midpoint of the selected point.
this is what you an do: since AS is like a graph sheet use the same principle you would use went you where in school using the mipoint formula (x1+x2)(y1+y2) divide both x and y answer by 2 to get the X,Y position.
If you just want to know the x,y mid point number values I have another solution without need to run any script.
Select the two points with the Select Points tool. Then select the Translate points tool the input fields (x,y) in the tool options bar gives you the geometrical center of the selected points (which in the case of two points coincides with the midpoint)
I'm talking by memory and maybe it differs from the new version. I cannot check it in this computer now.
-G
that works too but the script give the exact position plus with the dialog box you can select a next point and still see the position so that you can type it i. GOOD JOB to you PONYSMASHER keep up the good work.
Genete i want you to tell me how to snap bone to a point that is not in alignment with the grid
Posted: Fri Jun 25, 2010 3:13 pm
by ponysmasher
Okay, I've sort of solved it.
Here's the script:
http://www.dauid.com/tools/scripts/ds_midpointbone.zip
And here's how it works:
Select the vector layer where the points are:
Use the select bone tool and select the bone:
Select two points:
Run the script and the bone is moved:
Now, if the bone is a child of another bone the placement will be off. I guess this is what you've been talking about.
If the bone is a child, before you run the script use the reparent bone tool and click anywhere but on a bone so the bone is no longer a child. Then run the script and after that, reparent the bone.
There probably is a way to calculate the bones position by getting the positions of the parent bones but this will have to do for now.
Posted: Fri Jun 25, 2010 5:14 pm
by hothead
Ponysmasher what can i do for you? You are the boss Simthmicro you need to hire this guy he very skill guy thanks a lot ponysmasher together we make a great team...
the script work good this script well be help full to everyone thanks again
Posted: Fri Jun 25, 2010 6:27 pm
by hothead
ok heres the last one i hope Bone Constraints
angle control bone, scale control bone and position control bone. all work one way. you can add constrain to a bone position control bone 0.5, 0.0 The bone well be constrain by 0.5 to left and 0.5 to the right when you move the parent bone left and right an the X axis. this maybe hard for you ponysmasher but i know you can do it here goes
i want to tell the bone that is been constraint that when i move the parent bone it to the left it constraint by 0.5 (SCRIPT) now when i move the parent bone to the right i dont want it to move 0.5 i want to input a different value like 36 any value. the result well be when i move the parent bone the bone that it is controling well move slower and at a short distance to the left than the parent bone move to the right side it we'll go faster and at a longer distance depends on the value enter.. so all three control angle control bone, scale control bone and position control bone should have two input area for a LEFT AND RIGHT move on the X-axis. ASP now use only one vaule to go left on right or up on down , i think the bone constraint system can be modified to have two input field.
or is there a way to let one child bone been constraint be two parent bone. presently you can have one to three parent control bone to control one child but you cant have one child bone to be control be two parent bone for for any one of the constraint scale, position and rotate control bone.