Using torque to always push a rigidbody upright while on ground
Posted: Sun Jun 16, 2019 6:06 am
Hello; this is my first post so please take it easy on me I have recently switched to C++ / Pullet from a combination of BlitzMax / ODE.
I want to start by showing what I'm trying to achieve. Here is a quick video of a first person hockey game where a character ends up being toppled by various means and always pushes back up to a standing position:
https://streamable.com/go15l
I was able to achieve this by applying torque to a rigidbody on BlitzMax because the ODE library came with Pitch/Yaw/Roll (0-360) retrieval built in, which I'm entirely comfortable with. I could use how far the character's pitch and roll were from zero (upright) when applying torque to achieve a standing up state and eventually built in measures to not overshoot.
I think you know where I'm going with this; I've entered the world of transforms & quaternions and I'm lost. I have scoured this forum and found similar posts about applying various forces to keep a rigidbody upright, and I've tried to find information with regards to retrieving / converting what bullet provides to Pitch Yaw and Roll. I've tried and tried so many examples and everything I've produced either flat out doesn't work properly or starts acting strangely once a rigid body's yaw goes 90 degrees in either direction.
I'm hoping that someone can help me along with this either via pseudocode or real code to demonstrate what I'm actually looking for. The character in the example above is built with a collection of spheres (I've accomplished this with btCompound). The part I don't understand how to do with this combination of tools is making the character stand up without affecting the yaw rotation. I don't know if it's possible to retrieve 360 degree Pitch/Yaw/Roll vectors with Bullet or if there is possibly a much better method at achieving this behavior. At this stage I'm happy to admit I'm a bit ignorant on the subject; but I've spent many days researching and trying.
It seems I've been able to learn so much but I don't even know where to begin here Thank you for your time
I want to start by showing what I'm trying to achieve. Here is a quick video of a first person hockey game where a character ends up being toppled by various means and always pushes back up to a standing position:
https://streamable.com/go15l
I was able to achieve this by applying torque to a rigidbody on BlitzMax because the ODE library came with Pitch/Yaw/Roll (0-360) retrieval built in, which I'm entirely comfortable with. I could use how far the character's pitch and roll were from zero (upright) when applying torque to achieve a standing up state and eventually built in measures to not overshoot.
I think you know where I'm going with this; I've entered the world of transforms & quaternions and I'm lost. I have scoured this forum and found similar posts about applying various forces to keep a rigidbody upright, and I've tried to find information with regards to retrieving / converting what bullet provides to Pitch Yaw and Roll. I've tried and tried so many examples and everything I've produced either flat out doesn't work properly or starts acting strangely once a rigid body's yaw goes 90 degrees in either direction.
I'm hoping that someone can help me along with this either via pseudocode or real code to demonstrate what I'm actually looking for. The character in the example above is built with a collection of spheres (I've accomplished this with btCompound). The part I don't understand how to do with this combination of tools is making the character stand up without affecting the yaw rotation. I don't know if it's possible to retrieve 360 degree Pitch/Yaw/Roll vectors with Bullet or if there is possibly a much better method at achieving this behavior. At this stage I'm happy to admit I'm a bit ignorant on the subject; but I've spent many days researching and trying.
It seems I've been able to learn so much but I don't even know where to begin here Thank you for your time