VPhysics-Jolt
VPhysics-Jolt copied to clipboard
Should pulleys be supported?
Hello,
Looking at the feature matrix there's a big cross next to 'Pully'. Should I implement pulley support for Jolt (I assume we're talking about a rope and pulley system as described here https://en.wikipedia.org/wiki/Pulley)?
The way I envision this working is similar to a GearConstraint. Basically you create 2 SliderConstraints to constrain both bodies at the end of a rope to a linear path. Then there will be a PulleyConstraint that links SliderConstraint::GetCurrentPosition of the 1st constraint to the 2nd via a ratio.
Would that allow you to implement it?
That sounds like a step in the right direction.
What we get on our end is the two object positions, the two pulley points, a ratio, whether or not the rope in the pulley is slack/rigid or not, the total length of the rope in the pulley system (excluding parts not under tension, so ignoring the horizontal that's just visual and does not affect the system) .
This corresponds to phys_pulleyconstraint. How it functioned was more like a distance constraint, implementing things like this:
The two cages are the physics bodies, suspended from the two pulley points above.
Thanks! It sounds a bit more complicated than what I had in mind but I'll try to make something.
I just submitted support for pulley joints. I think it should trivially map onto the source engine:
mFixedPosition1/2 = pulleyPosition[0/1] mBodyPosition1/2 = objectPosition[0/1] mMinLength = isRigid? totalLength : 0 mMaxLength = totalLength mRatio = gearRatio
https://github.com/jrouwe/JoltPhysics/commit/a30434a1b921d58120bb056aedc46afcadf88aab