Hi,
I'm using BulletPhysics 2.86.1.
I have called setAngularFactor(btVector3(0, 0, 1)) on my rigid body, but after calling stepSimulation the m_angularVelocity.x() and m_angularVelocity.y() started gaining non zero values, and at the end they became non-negligible.
Somehow btSequentialImpulseConstraintSolver called setAngularVelocity with btVector3 with non-zero x and y components.
Is it a bug in Bullet Physics or my expectations were wrong?
Best,
Piotr
AngularFactor == 0 but AngularVelocity != 0
-
- Posts: 50
- Joined: Thu Mar 24, 2016 10:22 am
- Location: France
Re: AngularFactor == 0 but AngularVelocity != 0
Hi,
You should use setAngularVelocity instead of setAngularFactor in order to reset your object angular velocity
You should use setAngularVelocity instead of setAngularFactor in order to reset your object angular velocity
-
- Posts: 8
- Joined: Mon Aug 15, 2016 7:11 pm
Re: AngularFactor == 0 but AngularVelocity != 0
I'm not sure I understand, should I zero angularVelocity.x after each step, even though my angularFactor.x is 0?
Maybe I'll rephrase my question.
Initial angularVelocity was 0,0,0 and angularFactor 0,0,1.
Still after a step of simulation angularVelocity's x and y where != 0.
Is it expected?
Maybe I'll rephrase my question.
Initial angularVelocity was 0,0,0 and angularFactor 0,0,1.
Still after a step of simulation angularVelocity's x and y where != 0.
Is it expected?
-
- Posts: 50
- Joined: Thu Mar 24, 2016 10:22 am
- Location: France
Re: AngularFactor == 0 but AngularVelocity != 0
It's weird indeed. How much is the difference each steps ?
Otherwise, you can use the tick callback system to set 0 velocity to your body.
Otherwise, you can use the tick callback system to set 0 velocity to your body.
-
- Posts: 8
- Joined: Mon Aug 15, 2016 7:11 pm
Re: AngularFactor == 0 but AngularVelocity != 0
I'm not at the computer right now, but at first angular velocity was tiny, but after couple of thousand of steps it became really large.
For what it's worth the body was a compound shape composed of two convex hull shapes (computed by vhacd) moving in a box build of static plane shapes with gravity slightly changing every couple of steps.
For what it's worth the body was a compound shape composed of two convex hull shapes (computed by vhacd) moving in a box build of static plane shapes with gravity slightly changing every couple of steps.
-
- Posts: 8
- Joined: Mon Aug 15, 2016 7:11 pm
Re: AngularFactor == 0 but AngularVelocity != 0
Below are first few values passed to setAngularVelocity by the btSequentialImpulseConstraintSolver (z is unconstrained so it's ok it's non-zero).
The workaround zeroing the velocity at each tick works ok for me, thanks.
x: 0.000000000 y: 0.000000000 z: 5.82549120e-10
x: 0.000000000 y: -4.33680869e-19 z: 8.80287232e-10
x: 0.000000000 y: -4.33680869e-19 z: 8.80287232e-10
x: -5.55111512e-17 y: 2.16840409e-19 z: 9.58578106e-10
x: -5.55111512e-17 y: 2.16840409e-19 z: 9.58578106e-10
x: -5.55111512e-17 y: 4.33680869e-19 z: 4.40360415e-10
x: -4.16333634e-17 y: 3.25260652e-19 z: 6.22335738e-10
x: -8.32667268e-17 y: 7.58941521e-19 z: 8.46161696e-10
x: -5.55111512e-17 y: 6.50521303e-19 z: 1.02264475e-09
x: -1.11022302e-16 y: 8.67361738e-19 z: -1.22654220e-10
x: -1.11022302e-16 y: 8.67361738e-19 z: 3.81572551e-11
x: -1.07552856e-16 y: 8.60585474e-19 z: 5.38624478e-10
x: -8.32667268e-17 y: 8.67361738e-19 z: 2.43765841e-10
x: -8.32667268e-17 y: 9.21571847e-19 z: 9.07441677e-10
x: -8.32667268e-17 y: 7.58941521e-19 z: 3.99350419e-09
x: -1.11022302e-16 y: 2.16840434e-19 z: -1.54626523e-09
x: -3.33066907e-16 y: 8.67361738e-19 z: -7.83867804e-10
x: -3.33066907e-16 y: 5.42101086e-19 z: -1.36592682e-10
x: -3.33066907e-16 y: 5.55653613e-19 z: 5.36745093e-10
x: -3.05311332e-16 y: 4.33680869e-19 z: 9.62212643e-10
x: -2.77555756e-16 y: -1.08420191e-19 z: -1.55775393e-12
x: -2.77122075e-16 y: -1.07996701e-19 z: -4.25992103e-10
x: -2.63677968e-16 y: -1.62630326e-19 z: 6.41859621e-11
The workaround zeroing the velocity at each tick works ok for me, thanks.
x: 0.000000000 y: 0.000000000 z: 5.82549120e-10
x: 0.000000000 y: -4.33680869e-19 z: 8.80287232e-10
x: 0.000000000 y: -4.33680869e-19 z: 8.80287232e-10
x: -5.55111512e-17 y: 2.16840409e-19 z: 9.58578106e-10
x: -5.55111512e-17 y: 2.16840409e-19 z: 9.58578106e-10
x: -5.55111512e-17 y: 4.33680869e-19 z: 4.40360415e-10
x: -4.16333634e-17 y: 3.25260652e-19 z: 6.22335738e-10
x: -8.32667268e-17 y: 7.58941521e-19 z: 8.46161696e-10
x: -5.55111512e-17 y: 6.50521303e-19 z: 1.02264475e-09
x: -1.11022302e-16 y: 8.67361738e-19 z: -1.22654220e-10
x: -1.11022302e-16 y: 8.67361738e-19 z: 3.81572551e-11
x: -1.07552856e-16 y: 8.60585474e-19 z: 5.38624478e-10
x: -8.32667268e-17 y: 8.67361738e-19 z: 2.43765841e-10
x: -8.32667268e-17 y: 9.21571847e-19 z: 9.07441677e-10
x: -8.32667268e-17 y: 7.58941521e-19 z: 3.99350419e-09
x: -1.11022302e-16 y: 2.16840434e-19 z: -1.54626523e-09
x: -3.33066907e-16 y: 8.67361738e-19 z: -7.83867804e-10
x: -3.33066907e-16 y: 5.42101086e-19 z: -1.36592682e-10
x: -3.33066907e-16 y: 5.55653613e-19 z: 5.36745093e-10
x: -3.05311332e-16 y: 4.33680869e-19 z: 9.62212643e-10
x: -2.77555756e-16 y: -1.08420191e-19 z: -1.55775393e-12
x: -2.77122075e-16 y: -1.07996701e-19 z: -4.25992103e-10
x: -2.63677968e-16 y: -1.62630326e-19 z: 6.41859621e-11