bullet3 icon indicating copy to clipboard operation
bullet3 copied to clipboard

Quaternion Based 6DOF Spring Joint Constraint

Open 19PHOBOSS98 opened this issue 1 year ago • 4 comments

Hello, I saw that there was a "demand" for Quaternion Based 6DOF Spring Joint Constraint calculation:

https://github.com/bulletphysics/bullet3/issues/4162 https://pybullet.org/Bullet/phpBB3/viewtopic.php?t=8153

So I made a new class:

btGeneric6DofSpringConstraintQuaternion

Based on btGeneric6DofSpring2Constraint. This class was made to provide more control over spring joint "equilibrium" rotation using quaternions instead of Euler Axes. This makes it useful for "puppeteering" joint controlled active ragdolls.

I also took the liberty of adding in a new example scene in the explorer. image (Quaternion Based Joints (left, center); Euler Axis Based Joint (right)) Per the image, the set equilibrium angles are as follows: X:0° Y:90° Z:45°

More rotation settings are available in the DOF6SpringQuatSetup.cpp file. Change the following macro definitions as you see fit: USE_6DOF(Q, ,2) ROTATION_([1-6])

image image

19PHOBOSS98 avatar Aug 09 '22 12:08 19PHOBOSS98

If there's anything I missed, I'd be happy to comply.

19PHOBOSS98 avatar Aug 09 '22 13:08 19PHOBOSS98

image hmm, for some reason it found function "Dof6SpringQuatCreateFunc" unresolved...

19PHOBOSS98 avatar Aug 10 '22 01:08 19PHOBOSS98

image Nope, still didn't work... what gives?

19PHOBOSS98 avatar Aug 10 '22 01:08 19PHOBOSS98

image Nope, still didn't work... what gives?

Its an exact copy of Dof6Spring2Setup.cpp (.h) I just renamed the function

19PHOBOSS98 avatar Aug 10 '22 02:08 19PHOBOSS98

Thanks for the PR. From Appveyor failed build, it looks like the build is broken. Some cmake or premake build files need updating, adding the new c++ file?

erwincoumans avatar Sep 25 '22 02:09 erwincoumans

Thanks for the PR. From Appveyor failed build, it looks like the build is broken. Some cmake or premake build files need updating, adding the new c++ file?

Hello. Sorry for the late reply. I hope I'm not too late to get this PR accepted. I'm not sure what part of the cmake file to update or what c++ file I should add to resolve this. What should I do?

19PHOBOSS98 avatar Jan 29 '23 13:01 19PHOBOSS98

Thanks for the PR. From Appveyor failed build, it looks like the build is broken. Some cmake or premake build files need updating, adding the new c++ file?

Hello. Sorry for the late reply. I hope I'm not too late to get this PR accepted. I'm not sure what part of the cmake file to update or what c++ file I should add to resolve this. What should I do?

I might be wrong but I think I figured it out. I think I have to update this cmake file under this directory: Screen Shot 2023-01-29 at 10 38 27 PM

I have to add in my DOF6SpringQuatSetup somewhere here:

Screen Shot 2023-01-29 at 10 38 19 PM

brb...

19PHOBOSS98 avatar Jan 29 '23 14:01 19PHOBOSS98

noice, it worked!

19PHOBOSS98 avatar Jan 29 '23 22:01 19PHOBOSS98

@erwincoumans, please review :)

19PHOBOSS98 avatar Jan 30 '23 00:01 19PHOBOSS98