Modeling a muscle with a spring and a slider

amatic
Posts: 13
Joined: Sun Oct 25, 2015 10:17 am

Modeling a muscle with a spring and a slider

Post by amatic »

I'm making a model of a simple muscle as a spring constraint and a slider constraint in series. I'll need more muscles, so I'm making a class that takes two bodies and pivots on them and puts a muscle in between. End result should have: bodyA - spring - slider - bodyB, with handles for spring length and setting motor velocity.

I'm still learning to use bullet, my current approach is like this:
BodyA -> pointConstraint -> sphere -> spring2constraint -> sphere -> sliderConstraint -> sphere -> pointConstraint - bodyB.

Since the muscle will connect two bodies that are connected by a hinge joint, the enpoints of the muscle need to be able to freely rotate, that is why the additional point constraints and spheres.

Seems to be working fine with this setup. However, I noticed that the spring2constraint has motors in it. Could these motors be used instead of the separate slider constraint?

Also, since the spring is linear, is there a way to make it a bit nonlinear?
amatic
Posts: 13
Joined: Sun Oct 25, 2015 10:17 am

Re: Modeling a muscle with a spring and a slider

Post by amatic »

This is the current setup:
Image