Revolution joint limits

General discussion about the R.U.B.E editor
Post Reply
nikcain
Posts: 7
Joined: Wed Dec 26, 2012 11:58 am

Revolution joint limits

Post by nikcain »

Hi,

I'm trying to create a spring by joining multiple bars together with revolute joints, like;

Code: Select all

 -----
@
 -----
      @
 -----
and then joining the center of each bar with two distance joints, one long and one short. I was hoping that the two distance joints would fight against each other to create springiness, while the revolute joints would maintain the spring shape.

It almost works, but the spring wants to completely unwind and turn itself inside out. Have I misunderstood the revolute limits? I tried to limit it so the bars would only separate by about 90 degrees, but instead they turn almost all the way round.

I've attached the rube file (forum wouldn't let me upload a *.rube file though, so zipped it)

Nik
Attachments
spring.zip
(1.4 KiB) Downloaded 795 times
iforce2d
Site Admin
Posts: 861
Joined: Sat Dec 22, 2012 7:20 pm

Re: Revolution joint limits

Post by iforce2d »

Hi nik

Firstly these bodies might be a bit long and thin to get a nice stable simulation, you might want to add a bit more rotational inertia (eg. another fatter fixture, could have collision filter mask set to zero so it doesn't actually collide with anything). However, it seems to run ok though...

The middle revolute joint is starting in a position which violates its constraints. Try setting the joint reference angle to zero and the limits to -45 and 45, the same as the other two joints.

You seem to have some extraneous distance joints piled on top of each other, I would think you really only need three for this? The frequency setting is very low, which means these joints will not have enough power to do much.

Check out the attachment, I made the following changes:
1. Set middle revolute joint reference angle and limits
2. Delete unnecessary distance joints
3. Change all distance joint frequency values from 0.1 to 2
Attachments
spring-CC130105.rube.zip
(1.3 KiB) Downloaded 787 times
nikcain
Posts: 7
Joined: Wed Dec 26, 2012 11:58 am

Re: Revolution joint limits

Post by nikcain »

That works perfectly, thank you very much :D

I was obviously confusing myself with too many things - seems obvious now that I only needed one distance joint between each bar, plus the reference angle. Once stuck I just kept digging myself into a bigger mess.

ps. really appreciating the editor, I'm still learning my way round it but it's doing great!
Post Reply