strange capsule behaviour
-
- Posts: 34
- Joined: Tue Mar 04, 2008 3:16 pm
strange capsule behaviour
Hi,
is this behaviour of the capsule shape normal? -> http://www.youtube.com/watch?v=Loy-TiOo-_Q
I didn't change the center of the mass or the collision margins.
Regards,
shogun
is this behaviour of the capsule shape normal? -> http://www.youtube.com/watch?v=Loy-TiOo-_Q
I didn't change the center of the mass or the collision margins.
Regards,
shogun
-
- Posts: 10
- Joined: Wed Jul 29, 2009 4:04 am
- Location: Seoul, Korea
Re: strange capsule behaviour
Hi,
Which type of capsule do you use?
We have used btCapsuleShapeZ before and suffered from similar problem..
Now we use btMultiSphereShape composed of 2 sphere with same radius and problem is gone. (its debug draw was horrible but now fixed on recent commit )
Moreover, our character got more realistic knock-down rolling without a full-featured ragdoll with a single multisphere composed of one big sphere (head) and two small sphere (legs) just adding on the fly.
Thanks
p.s. I think that rendering quality on the video is awesome. May I ask which engine do you use?
Which type of capsule do you use?
We have used btCapsuleShapeZ before and suffered from similar problem..
Now we use btMultiSphereShape composed of 2 sphere with same radius and problem is gone. (its debug draw was horrible but now fixed on recent commit )
Moreover, our character got more realistic knock-down rolling without a full-featured ragdoll with a single multisphere composed of one big sphere (head) and two small sphere (legs) just adding on the fly.
Thanks
p.s. I think that rendering quality on the video is awesome. May I ask which engine do you use?
-
- Posts: 34
- Joined: Tue Mar 04, 2008 3:16 pm
-
- Posts: 34
- Joined: Tue Mar 04, 2008 3:16 pm
Re: strange capsule behaviour
I changed the capsule to multi sphere ...
EDIT: I just tested the whole thing again, this time with cylinders. The do exactly the same strange tumbling. Hm.
Not in my case. The behaviour is pretty much the same.Ellon wrote:Now we use btMultiSphereShape composed of 2 sphere with same radius and problem is gone.
EDIT: I just tested the whole thing again, this time with cylinders. The do exactly the same strange tumbling. Hm.
-
- Posts: 141
- Joined: Tue Sep 16, 2008 11:31 am
Re: strange capsule behaviour
Looks like the center of mass is on one side (not in the center ).
-
- Posts: 34
- Joined: Tue Mar 04, 2008 3:16 pm
Re: strange capsule behaviour
Yes, it looks like that. But as I said, the center of mass IS in the center.
-
- Posts: 141
- Joined: Tue Sep 16, 2008 11:31 am
Re: strange capsule behaviour
Oh, sorry, but you wrote that you didn't change the center of mass... I'm thinking maybe you should try changing it?
-
- Posts: 34
- Joined: Tue Mar 04, 2008 3:16 pm
Re: strange capsule behaviour
The thing is, to move an object's center of mass in Bullet you have to create a compound object. I don't know if this is a good solution, especially as I don't know where my current "virtual center of mass" is.
-
- Posts: 84
- Joined: Sun Jan 07, 2007 4:29 pm
- Location: Oxford, England
Re: strange capsule behaviour
It's behaving like this because when a capsule is rolling on its end like in your video, it spins much faster than a cylinder would for the same linear velocity, so it behaves strongly as a gyroscope. Rather than the non-contacting end falling down, the capsule rolls in a circle (to the left in your case).
It should be doing this to some extent - as to whether it's doing it more than it should be in Bullet - perhaps you should check that the inertia is being calculated correctly.
Remember also that you probably don't have much real-world experience with how objects like this behave - when was the last time you played with a 1.5m (?) high capsule?!
It should be doing this to some extent - as to whether it's doing it more than it should be in Bullet - perhaps you should check that the inertia is being calculated correctly.
Remember also that you probably don't have much real-world experience with how objects like this behave - when was the last time you played with a 1.5m (?) high capsule?!
-
- Posts: 34
- Joined: Tue Mar 04, 2008 3:16 pm
Re: strange capsule behaviour
I could live with that ... but I tested the cylinder and it behaved exactly like the capsule.DannyChapman wrote:It's behaving like this because when a capsule is rolling on its end like in your video, it spins much faster than a cylinder would for the same linear velocity, so it behaves strongly as a gyroscope. Rather than the non-contacting end falling down, the capsule rolls in a circle (to the left in your case).
It's calculated just like in the demos.It should be doing this to some extent - as to whether it's doing it more than it should be in Bullet - perhaps you should check that the inertia is being calculated correctly.
Thanks for your reply!
Last edited by shogun on Fri Jul 31, 2009 3:53 pm, edited 1 time in total.
-
- Posts: 861
- Joined: Sun Jul 03, 2005 4:06 pm
- Location: Kirkland, WA
Re: strange capsule behaviour
I think it is exactly as Danny pointed out. Bullet as many other engines drop the coriolies term from the force computation because of stability issues. To test whether your problem is related to this you can add the torque yourself. For an explanation look here:
http://en.wikipedia.org/wiki/Newton%E2% ... _equations
The issues you notice is because of the (w x I * w) being dropped. If you add this term the whole system might get unstable and explode though. In this case you have to choose a smaller timestep.
http://en.wikipedia.org/wiki/Newton%E2% ... _equations
The issues you notice is because of the (w x I * w) being dropped. If you add this term the whole system might get unstable and explode though. In this case you have to choose a smaller timestep.
-
- Posts: 10
- Joined: Wed Jul 29, 2009 4:04 am
- Location: Seoul, Korea
Re: strange capsule behaviour
Checking my code again, I found that I adjusted friction and dampings addition to changing shape.
In my case I'm using 2.0m capsule and tried to reproduce your case, applied following:
On plane ground, this spins exactly like yours (doesn't fall down *naturally* and looks like gyro)
I think Danny and Dirk suggests is the correct explanation of this phenomenum. But before going to have hard time to implementing coriolies term, how about to try this:
This reduced the gyro-like spinning alot and looks much natural on my case.
I'm sorry for not being helpful..
In my case I'm using 2.0m capsule and tried to reproduce your case, applied following:
Code: Select all
body->setLinearVelocity(btVector3(5,5,0));
body->setAngularVelocity(btVector3(0,0,5));
I think Danny and Dirk suggests is the correct explanation of this phenomenum. But before going to have hard time to implementing coriolies term, how about to try this:
Code: Select all
// numbers should be tested
body->setDamping(0.3, 0.5);
body->setFriction(0.1);
I'm sorry for not being helpful..
-
- Posts: 34
- Joined: Tue Mar 04, 2008 3:16 pm
Re: strange capsule behaviour
Well, you're very helpful. (You all are.)
I will try to tweak the damping.
The strange behaviour of capsules/cylinders isn't a big problem for me - I just wondered if it was "just me" or expected.
Regards,
shogun
I will try to tweak the damping.
The strange behaviour of capsules/cylinders isn't a big problem for me - I just wondered if it was "just me" or expected.
Regards,
shogun
-
- Posts: 861
- Joined: Sun Jul 03, 2005 4:06 pm
- Location: Kirkland, WA
Re: strange capsule behaviour
To try the gyroscopiv term you could maybe quickly try this:
btVector3 tau = cross( body->getAngularVelocity(), body->getGlobalInertia() * body->getAngularVelocity() );
body->applyTorque( tau );
The force needs to be applied each frame.
Cheers,
-Dirk
btVector3 tau = cross( body->getAngularVelocity(), body->getGlobalInertia() * body->getAngularVelocity() );
body->applyTorque( tau );
The force needs to be applied each frame.
Cheers,
-Dirk