Physion

  • Increase font size
  • Default font size
  • Decrease font size
Welcome, Guest
Username Password: Remember me

Scripting Chains/Rope
(1 viewing) (1) Guest
  • Page:
  • 1

TOPIC: Scripting Chains/Rope

Scripting Chains/Rope 6 years, 3 months ago #676

  • markwil
  • OFFLINE
  • Fresh Boarder
  • Posts: 1
Hi everyone,

Is there a way of accurately positioning anchoring points of chains/rope in your script file?

I'm trying to simulate a system of pulleys but in order for the model to be worthwhile, the length of chain/rope and anchoring points must be exact.

Any ideas?

Re: Scripting Chains/Rope 6 years, 3 months ago #678

Hi markwil.
I'm not sure how it could be done with scripting. Others know a lot more than me.
Yes, chains & ropes can get fiddly. Notice first, (image below), how the 'chains'
automatically default to points attached, if you have selected those options, like
First, Last, Both or None, and the setting is remembered when closing. Both of
these can be changed from the toolbar. They are just circles, and rectangles,
that have been linked, but with the links invisible. You can delete any existing
revolute points, and/or add others, when & where you wish.
This image is hidden for guests. Please log in or register to see it.
Once the rope or chain has been drawn, you can delete individual links off the end.
The easiest way that i have found, is to do the following. Start with a rough layout...
This image is hidden for guests. Please log in or register to see it.
Now, turn WORLD GRAVITY OFF, so the rope will not 'fall', and temporarilly
make the circles, or what ever you have, 'Kinematic', so they won't move. Turn off
auto-snapping with [F10], and put a temporary revolute pin at one end of the rope.
And then, while running the simulation, slowly drag the 'free' end to pull things up.
IMPORTANT: The [SPACE] bar also starts/stops the simulation, so WHILE holding
the dragged end in place, with the mouse, (not too much tension!), hit the [SPACE]
bar, to stop the simulation, and keep things in place...
This image is hidden for guests. Please log in or register to see it.
Now delete the unwanted segments, as per below...
This image is hidden for guests. Please log in or register to see it.
Now we move the last free segment with the Properties, while it is stopped !
Click on the last link, and adjust the link-segments X, Y, & Angle, so it is in position,
fine-tuning the numbers with numeric entries, not just the mouse-scroll clicks.
Notice how, (shown in the green circle), that the link appears broken, to the
second-to-last link? Don't worry about it. All will be fixed...
This image is hidden for guests. Please log in or register to see it.
Now delete te revolute-pin, and place 2 small distance-joints close together, as seen
in red. I've found that just 1, can be a bit weak...
This image is hidden for guests. Please log in or register to see it.
Now quickly tap the space-bar TWICE, to start the sim for 1/2 sec. Result...
This image is hidden for guests. Please log in or register to see it.
See that the other links have snapped into place again, where thay should be!
NOTE: If you want REALLY small running-steps, you can enter in the Command-
Line, under the Console at the bottom, 'world.step()' without the quotes, and the
simulation will run for just 1 frame of time! Can repeat with UP arrow, then Enter.
Now the result looks a bit better, as per below...
This image is hidden for guests. Please log in or register to see it.
I hope this helps. You can also tension things later, if the location of the 'circles'
is not absolutely critical, (or one of them at least), by making, (example above),
the top circle Kinematic, (or pinned, remember F10 again to centre properly), and
the bottom circle un-pinned, and Dynamic, and run the sim for a few seconds, with
a bit of Y=-5 or what ever Gravity. So the rope settles in it's span.

[EDIT]
Here is an example, before 'threading', and after 'threading'....
This image is hidden for guests. Please log in or register to see it.
This image is hidden for guests. Please log in or register to see it.
Be careful about the weight of the rope, adding to the 'realism'. If this is mucking
up what you are trying to do, you can decrease the 'Density' of the links, but be
careful, as very low density links also seem to be VERY weak too!. There may be
lots of links, so instead of changing them all manually, you can do this...

Ckeck the 'item' range, for the link-segments. Above example, 'item11' to 'item57'.
Now enter, (paste), this line below, into the console command-line, & Enter...
for (count = 11; count <58; count++) world.physicsItemFromName("item"+count).Density = 0.1;

What that does, is go through all items 11 to 57, and change the Density. Simple!

Be careful too, because the links will collide with each other, and can't cross over.
Have a good day.
1x1 square diag = root-2. Cube diag = root-3. Beautiful !
Last Edit: 6 years, 3 months ago by Glenn555.
  • Page:
  • 1
Moderators: Lynxx, Glenn555
Time to create page: 0.11 seconds