setLinearVelocity and Static objects

Post Reply
maiklof
Posts: 24
Joined: Wed Nov 20, 2013 10:01 am

setLinearVelocity and Static objects

Post by maiklof »

Hi,
I´ve read in old threads that it was possible to simulate a conveyor belt just by creating a static object and setting setLinearVelocity to it before each simulation step.
I have tried to reproduce it by modifying the HelloWorld demo from Bullet 2.82, but it does not seem to work. Has this functionality been removed?
Thanks!
maiklof
Posts: 24
Joined: Wed Nov 20, 2013 10:01 am

Re: setLinearVelocity and Static objects

Post by maiklof »

Hi again,
I've been testing with older versions and it seems to work in version 2.79, but not in 2.81. I would like to know if it has been removed (if is so, why?) or is just a bug.
Basroil
Posts: 463
Joined: Fri Nov 30, 2012 4:50 am

Re: setLinearVelocity and Static objects

Post by Basroil »

Are you sure you didn't mean kinematic object?
maiklof
Posts: 24
Joined: Wed Nov 20, 2013 10:01 am

Re: setLinearVelocity and Static objects

Post by maiklof »

No Basroil, there are several post about it:
http://bulletphysics.org/Bullet/phpBB3/ ... 05&start=0
http://bulletphysics.org/Bullet/phpBB3/ ... 441#p21441

I've been doing it using the friction direction an a contact Callback, but I wanted to try this too...
Thanks!
Basroil
Posts: 463
Joined: Fri Nov 30, 2012 4:50 am

Re: setLinearVelocity and Static objects

Post by Basroil »

Misread the original post, I thought you meant the static object was supposed to move.

There's a hell of a lot of code changes between 2.79 and 2.81, including quite a few to friction and contact handling in general. Tried reverting to older revisions until one works?
maiklof
Posts: 24
Joined: Wed Nov 20, 2013 10:01 am

Re: setLinearVelocity and Static objects

Post by maiklof »

Hi Basroil,
Yes, as I said, it works in 2.79 but not in 2.81 and 2.82... Any idea where in the code this can be implemented... Still the question is if the feature has been removed or is just a bug... I've tried to find out by myself, but as you said, there are too many changes and the code is not commented very in detail...
Thanks anyway!
Basroil
Posts: 463
Joined: Fri Nov 30, 2012 4:50 am

Re: setLinearVelocity and Static objects

Post by Basroil »

maiklof wrote:Hi Basroil,
Yes, as I said, it works in 2.79 but not in 2.81 and 2.82... Any idea where in the code this can be implemented... Still the question is if the feature has been removed or is just a bug... I've tried to find out by myself, but as you said, there are too many changes and the code is not commented very in detail...
Didn't mean check fixed releases, rather patch history. If you revert back to ~r2500 and it works, then you know it's some change after that that was causing issues. Ones that seem like they could have something to do with the issue are r2547 (commit 84b1774dda1f3a8d858af08bf11f9996dac0f5ff using GIT) and r2462/3 (commit 76785d6e01cfd96eb13ac2cd22b3879e59174f3f using GIT), though it could be just about anything. If you use GIT, it's incredibility easy to check out an earlier revision, so testing for exactly when the error happened will take at most ~14 tries and not even a few hours of testing (mostly just GIT update and recompile time). If you know when it broke, you can check the changes made and know exactly why it broke.
maiklof
Posts: 24
Joined: Wed Nov 20, 2013 10:01 am

Re: setLinearVelocity and Static objects

Post by maiklof »

Thanks again Basroil!
I have never used GIT, but what you say makes sense and seems easy, so I will try it. I will update the post if I find what caused the issue...
maiklof
Posts: 24
Joined: Wed Nov 20, 2013 10:01 am

Re: setLinearVelocity and Static objects

Post by maiklof »

Ok, now I know it is something that happened between r2534 and r2535... There are around 15 modified files, but I will try to find the one causing the issue...
maiklof
Posts: 24
Joined: Wed Nov 20, 2013 10:01 am

Re: setLinearVelocity and Static objects

Post by maiklof »

Summary:
From r2534 to r2335 a change was made to 'improve handling of restitution by using the velocity (linear/angular) before applying forces: this is done by re-introducing the btSolverBody and only apply the forces to solver body, and use the original rigid body velocity for restitution computation.'
I would say that because of this change, applying linear velocity (setLinearVelocity()) to static objects in order to make them behave as conveyor belts, is no longer working.

Is this a bug? or is something incompatible with a proper handling of the restitution? Could someone help me to find out how to make this work with the version 2.82?

Thanks!
Basroil
Posts: 463
Joined: Fri Nov 30, 2012 4:50 am

Re: setLinearVelocity and Static objects

Post by Basroil »

maiklof wrote: Is this a bug? or is something incompatible with a proper handling of the restitution? Could someone help me to find out how to make this work with the version 2.82?
Looks like a lot changed there and static objects seem to be assumed to have zero/ unchanging velocities to avoid calculations. Have you checked to see if a callback to setting velocity at every frame fixes it?
maiklof
Posts: 24
Joined: Wed Nov 20, 2013 10:01 am

Re: setLinearVelocity and Static objects

Post by maiklof »

I´ve tried to setLinearVelocity() before each world step, but it does not fix it... I think that been able to make surfaces behave as conveyor belts can be a nice feature, for both static and dynamic objects, and it would be nice to be able to do it just calling one method... But I think I have to continue using the custom callback ;)!
Thanks Basroil!
Basroil
Posts: 463
Joined: Fri Nov 30, 2012 4:50 am

Re: setLinearVelocity and Static objects

Post by Basroil »

maiklof wrote:I´ve tried to setLinearVelocity() before each world step, but it does not fix it... I think that been able to make surfaces behave as conveyor belts can be a nice feature, for both static and dynamic objects, and it would be nice to be able to do it just calling one method... But I think I have to continue using the custom callback ;)!
Pretty sure the custom callback is the preferred method anyway :wink:

If your entire world is comprised of conveyer belts, you could try to see where the updates fell apart, likely a call that used to go to getLinearVelocity was rerouted, or a collision with a static object was simplified as a maximum reduction in velocity (since one static object velocity is the same as any another in the world, why bother wasting time checking the linear velocity if you know it's supposed to be 0?), but if you're talking about a few things, there's less chance of breaking something else by just working around. At least until Erwin/Dirk can give you input on the issue (perhaps it's a stability thing, maybe performance, maybe just a bug).

If you do find out what happened, please do share, it'll help those that have a similar issue later.
Post Reply