Physics Simulation Forum

 

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Fri May 11, 2012 4:21 pm 
Offline

Joined: Fri May 11, 2012 4:13 pm
Posts: 2
If I have an object with a linear factor of (0,0,0) and an angular factor of (1,1,1), I'd expect an impulse applied to this object to cause it to rotate (unless the impulse is aimed directly at the objects centre of mass).
But the impulse is scaled by the linear factor before being appllied as a torque impulse, which means that the object currently fails to rotate. :(

I have locally fixed this by going into this function:
btRigidBody::applyImpulse
And changing this line:
applyTorqueImpulse(rel_pos.cross(impulse*m_linearFactor));
To this:
applyTorqueImpulse(rel_pos.cross(impulse));

I'd be interested in knowing if this is indeed a bug, or I am misunderstanding the meaning of the m_linearFactor variable.
Thanks! :)


Top
 Profile  
 
PostPosted: Sat May 12, 2012 6:02 am 
Offline
User avatar

Joined: Tue Mar 16, 2010 1:42 am
Posts: 57
It does look like the code is a bit confused about whether the linear factor is a scale factor that is applied to the forces/impulses acting on the body, or only on that part that induces a linear motion.

Usually the linear factor isn't changed from its default of (1,1,1), in which case it isn't an issue. To prevent a body from moving linearly a constraint would be used instead, which has the advantage of preserving the energy of the system (unlike scaling the forces to 0).

---JvdL---


Top
 Profile  
 
PostPosted: Mon May 14, 2012 8:50 am 
Offline

Joined: Fri May 11, 2012 4:13 pm
Posts: 2
Thanks for the reply :)
For my purposes, I'm not worried about a loss of energy if it gives me higher stability and performance than using a constraint (and less code to write!).
It sounds like it's probably just a bit buggy (or inconsistent) due to being rarely used.


Top
 Profile  
 
PostPosted: Tue May 15, 2012 3:33 am 
Offline

Joined: Thu May 10, 2012 4:51 am
Posts: 3
Location: sfbay
You should file a bug on http://code.google.com/p/bullet/issues/list


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

All times are UTC


Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 5 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