Physics Simulation Forum

 

All times are UTC




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Thu Aug 31, 2017 3:53 pm 
Offline

Joined: Mon Aug 15, 2016 7:11 pm
Posts: 8
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


Top
 Profile  
 
PostPosted: Thu Aug 31, 2017 4:51 pm 
Offline

Joined: Thu Mar 24, 2016 10:22 am
Posts: 38
Location: France
Hi,

You should use setAngularVelocity instead of setAngularFactor in order to reset your object angular velocity


Top
 Profile  
 
PostPosted: Thu Aug 31, 2017 5:24 pm 
Offline

Joined: Mon Aug 15, 2016 7:11 pm
Posts: 8
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?


Top
 Profile  
 
PostPosted: Thu Aug 31, 2017 5:50 pm 
Offline

Joined: Thu Mar 24, 2016 10:22 am
Posts: 38
Location: France
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.


Top
 Profile  
 
PostPosted: Thu Aug 31, 2017 6:43 pm 
Offline

Joined: Mon Aug 15, 2016 7:11 pm
Posts: 8
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.


Top
 Profile  
 
PostPosted: Fri Sep 01, 2017 7:03 am 
Offline

Joined: Mon Aug 15, 2016 7:11 pm
Posts: 8
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC


Who is online

Users browsing this forum: Baidu [Spider], Bing [Bot], Google [Bot] and 18 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group