appAnimatedGenericJointDemo

Show what you made with Bullet Physics SDK: Games, Demos, Integrations with a graphics engine, modeler or any other application
Post Reply
Flix
Posts: 456
Joined: Tue Dec 25, 2007 1:06 pm

appAnimatedGenericJointDemo

Post by Flix »

This is an extension of the Bullet appGenericJointDemo (the ragdoll demo that uses btGeneric6DofConstraints as joints).
The joints are animated by applying motors to the constraint axis (thus the animations aren't "quaternion" based, but just "Euler" based) like in the Bullet appForkliftDemo and appDynamicControlDemo (also known as appMotorDemo: the "mechanized spider" demo).

IMPORTANT: This is not intended to be an optimal solution; it's just a starting point that can be used by developers who want to implement something similiar from scratch.

Screenshot:
AnimatedRagdollDemo.JPG
AnimatedRagdollDemo.JPG (25.08 KiB) Viewed 13048 times
Source code + precompiled binary for Win32 (compiled with Visual C++ 2008 and /MD, Visual C++ 2008 Redistributable Package required):
AnimatedGenericJointDemo.7z
(273.5 KiB) Downloaded 861 times
srikrishna3118
Posts: 6
Joined: Wed Dec 11, 2013 9:27 am

Re: appAnimatedGenericJointDemo

Post by srikrishna3118 »

hi Flix,
I have gone through your code of Ragdoll adn addition of custom animation to it. I have some doubts can you please clear it.

1) why did you set the augular factor of pelvis bone in Y direction and how it counters the gravity and stands up. Can you suggest any other way to do it.

// Prevent ragdoll from falling (most people won't like it)
m_bodies[BODYPART_PELVIS]->GetRigidBody()->setAngularFactor(btVector3(0,1,0));

2) If I want to create an animation from the data file having some rotations to some particular bone.
my preliminary thought is to create a btAnimation variable and based on the bone name we add the keyframes to that variable till that point is ok how to play this animation at the same time i.e the adding keyframes and the animation should happen at same time. here I am facing issue. please suggest something.
Flix
Posts: 456
Joined: Tue Dec 25, 2007 1:06 pm

Re: appAnimatedGenericJointDemo

Post by Flix »

srikrishna3118 wrote:1) why did you set the augular factor of pelvis bone in Y direction and how it counters the gravity and stands up. Can you suggest any other way to do it.
Because otherwise the character will fall. Another approach might be using a world-space btGenericDof6Constraint that keeps the character up.
srikrishna3118 wrote:2) If I want to create an animation from the data file having some rotations to some particular bone.
my preliminary thought is to create a btAnimation variable and based on the bone name we add the keyframes to that variable till that point is ok how to play this animation at the same time i.e the adding keyframes and the animation should happen at same time. here I am facing issue. please suggest something.
Well, it you mean you want to "merge" a piece of animation with another, I didn't get that far: the only thing I can think is just to make a whole new animation from scratch.

As I have clearly stated in my first post:

This is not intended to be an optimal solution; it's just a starting point that can be used by developers who want to implement something similiar from scratch.
StabInTheDark
Posts: 29
Joined: Sat May 18, 2013 1:36 am
Location: NY
Contact:

Re: appAnimatedGenericJointDemo

Post by StabInTheDark »

Thanks for contributing this demo I am going to try to develop off of it.
Did you get the idea from here?
http://animation.comp.nus.edu.sg/locotest.html

Is btAnimation in the bullet libs?
If so where?

edit: I Found btAnimation, I had assumed it was in bullet :oops:
Last edited by StabInTheDark on Sat Jan 25, 2014 5:17 pm, edited 1 time in total.
Flix
Posts: 456
Joined: Tue Dec 25, 2007 1:06 pm

Re: appAnimatedGenericJointDemo

Post by Flix »

StabInTheDark wrote:Did you get the idea from here?
I posted this demo on Fri Feb 10, 2012, so this stuff is nearly 2 years old. I've never seen that link (although it seems to be older than mine).
StabInTheDark wrote:Is btAnimation in the bullet libs?
Nope, it's in the code of the demo.
srikrishna3118
Posts: 6
Joined: Wed Dec 11, 2013 9:27 am

Re: appAnimatedGenericJointDemo

Post by srikrishna3118 »

Because otherwise the character will fall. Another approach might be using a world-space btGenericDof6Constraint that keeps the character up.
1) Can you please explain how it prevents the character from falling.
2) Can you please eloborate the another approach of using world space in btGenericDof6Constraint.
Well, it you mean you want to "merge" a piece of animation with another, I didn't get that far: the only thing I can think is just to make a whole new animation from scratch.
I will eloborate my project since i am working in a company i couldn't share my work with you.
1) I am using Assimp library for rendering the model animation.
2) Then I have added physics based skeleton to that model and using your idea I could make the model stand thanks for that.
3) Now I have to synchronise bullet world transformation with the model i am using and secondly I will get data from mocap sensors from socket and I need to feed that data to the physics world and after that I need to check the working in the model i rendered using assimp library.

I am actually struck near synchronization and real time animation. can you suggest any ideas how to proceed.

when I gave the translation and rotation information of the bullet skeleton from the ragdoll to certain bones in the assimp based rendered model following results are seen i have attached a vedio.
Attachments
desktop_bullet and collada model transformation.ogv.zip
(1.04 MiB) Downloaded 351 times
Flix
Posts: 456
Joined: Tue Dec 25, 2007 1:06 pm

Re: appAnimatedGenericJointDemo

Post by Flix »

srikrishna3118 wrote:1) Can you please explain how it prevents the character from falling.
By keeping the "pelvis" rigid body vertical all the time.
srikrishna3118 wrote:2) Can you please eloborate the another approach of using world space in btGenericDof6Constraint.
A btGenericDof6Constraint between the world and the "pelvis" rigid body can be used to replace the angular factor: the only advantage one can have is that it's possible "lock" the vertical axis while the character is moving. I had a functional demo modification about it, but I've lost it with my whole WindowsXP partition about a year ago, so I cannot share it. However there are some old posts in which I think I've explained this approach better: http://bulletphysics.org/Bullet/phpBB3/ ... f=9&t=8153 and http://bulletphysics.org/Bullet/phpBB3/ ... its#p27180. But honestly I don't know know if it's worth doing the change just to have the very tiny advantage I've described above.
srikrishna3118 wrote:3) Now I have to synchronise bullet world transformation with the model i am using and secondly I will get data from mocap sensors from socket and I need to feed that data to the physics world and after that I need to check the working in the model i rendered using assimp library.
I don't think that what you're trying to achieve is possible. The assimp imported skeleton is not made by rotations only, but by translations too and sometimes that's an offset (transform) between a bone and its child bones. Moreover that are maybe 6 different ways in which a btQuaternion/btMatrix3x3 can be converted to a set of 3 Euler angles. I guess it would be extremely difficult to port the Bullet world transforms to the corresponding assimp world (or local) transforms of the bones, and much more difficult it should be to take the opposite path.

In short: I have no idea on how you can do it and I've never tried or managed to do that myself. So I can't help you with that :)

P.S. Please remember that this demo is 2 years old, and probably now it should be worth using the Bullet Featherstone multibody support to do stuff related to ragdoll/skeletal animations.
srikrishna3118
Posts: 6
Joined: Wed Dec 11, 2013 9:27 am

Re: appAnimatedGenericJointDemo

Post by srikrishna3118 »

thanks for your time and suggestion. I will try it.
srikrishna3118
Posts: 6
Joined: Wed Dec 11, 2013 9:27 am

Re: appAnimatedGenericJointDemo

Post by srikrishna3118 »

hi Flix,
I could partially suceed in the goal of synchronizing bullet skeleton and the collada model using assimp library.
The assimp imported skeleton is not made by rotations only, but by translations too and sometimes that's an offset (transform) between a bone and its child bones.
Thanks for your sugestion actually i missed that point. Now for lower half of the body I could assign the rotations perfectly synchronized. you can see in the vedio
There is a small glitch in the beginning of synchronization. upper half has some problems though

If you could add some thing please let me know. I am now working on the upper half of the body.
Thanks for your time.
Attachments
out.wmv.zip
(687.43 KiB) Downloaded 443 times
Post Reply