Hi,
I'm doing a sort of marble game using bullet physics. Everything works fine, but I have just one small issue.
There are some platform in the game that are key frame animated. They are kinematic object and the animation and collision detection works. One of these platform is a a sort of "disc" spinning constantly along its up vector. When my sphere collide with this object it start to rotate in the opposite direction of the spinning disc and the the sphere position didn't change. What I want to achieve is that the ball feels more "heavy" and follow the disc spinning trajectory.
I tried to increase mass and gravity and it behave the same, I also tried to change the friction of the two object but doesn't seem to change at all. The only thing that seems to work is to set the angular damping to 1 but in this case the sphere stop to rotate at all even when I'm going to move trough user input (even if I apply torque or modify the linear velocity). It doesn't seem to be something related to the fact that the object is animated by keyframes, I tried to achieve the same animation applying a angular velocity along Z axis and I have the same issue.
Maybe I miss something, what do you suggest to solve the issue?
Thanks.
sphere collision on rotating platform issue
-
- Posts: 49
- Joined: Sun Jan 29, 2012 10:01 pm
Re: sphere collision on rotating platform issue
Try increasing the local inertia.
-
- Posts: 3
- Joined: Wed Mar 14, 2012 9:58 am
Re: sphere collision on rotating platform issue
It seems that the only way to change the local inertia is to use calculateLocalInertia on a collision shape using a mass parameter.
The disc doesn't have any mass because I don't want it move by the gravity, but just by the animation.
The disc doesn't have any mass because I don't want it move by the gravity, but just by the animation.
-
- Posts: 49
- Joined: Sun Jan 29, 2012 10:01 pm
Re: sphere collision on rotating platform issue
The local inertia is just a vector that you can set to btVector3(0.7f, 0.7f, 0.7f) when creating your rigid body.
-
- Posts: 3
- Joined: Wed Mar 14, 2012 9:58 am
Re: sphere collision on rotating platform issue
Hi,
I've tried to set up a local inertia that is greater by the one calculated using the collision shape. The only difference is that the sphere now tend to stop or change direction with delay when there is user input. When It goes trough the disc , it has the same behaviour as the previous version.
I've tried to set up a local inertia that is greater by the one calculated using the collision shape. The only difference is that the sphere now tend to stop or change direction with delay when there is user input. When It goes trough the disc , it has the same behaviour as the previous version.
-
- Posts: 456
- Joined: Tue Dec 25, 2007 1:06 pm
Re: sphere collision on rotating platform issue
No, I don't think you're missing anything. I think it's an interesting problem: according to your post it seems that kinematic objects have a bigger influence on the inertia than on the mass of a btSphereShape.anakabeth wrote:Maybe I miss something, what do you suggest to solve the issue?
I don't have any solution, but I think I'd try one of the following:
1) replace the btSphereShape with a btMultiSphereShape with a single sphere inside and see if the problem persists.
2) use a very high custom friction (e.g. 10-50) through a custom material callback and see if something changes (I'm not sure, but maybe without a custom material callback the friction is clamped to 1).
3) try to modify the split impulse property of the simulation (turn it on if it's disabled).
Hope some of these ideas might be helpful
