I often want to set bodies to a common x or y coordinate.
As an example, I would like to change the x position of five bodies to 0, and retain their current y position.
This is how it is achieved currently:
1. Select one of the five bodies
2. Select the "Position" textfield property
3. Select what's left of the comma and change it to the correct value
4. Goto 1 for the remaining four bodies
Separating x and y positions would reduce the workflow to:
1. Select all five bodies
2. Enter 0 in the x position textbox and press enter
This would also be useful for vertices.
Cheers,
Niclas
Separate position x and y coordinates in IDE
Re: Separate position x and y coordinates in IDE
Here is a script to do that:This is doing it for the x coordinate, but I think you can see how to make a similar script to change the y coordinate.
Code: Select all
float x = queryNumericValue("Enter value to align with");
body[] bs = sb();
for (uint i = 0; i < bs.length; i++) {
body b = bs[i];
b.setPos( x, b.pos.y );
}
Re: Separate position x and y coordinates in IDE
For vertices, perhaps you could try:
1. hit C,C to enter a cursor position manually
2. in the action menu choose "Vertex" -> "Align X to cursor"
1. hit C,C to enter a cursor position manually
2. in the action menu choose "Vertex" -> "Align X to cursor"
Re: Separate position x and y coordinates in IDE
Excellent! First time I use a Script and it works a charm.
Niclas
Niclas