Static object not responding to collision at certain angles

Zaladen
Posts: 25
Joined: Thu May 14, 2015 10:21 am

Static object not responding to collision at certain angles

Post by Zaladen »

Hi!

I have an odd problem. When I rotate a static object to a vertical position it doesn't react to objects, but when rotated at other angles it does. I can't figure out what the problem might be, it's very strange. Any suggestions?
User avatar
drleviathan
Posts: 849
Joined: Tue Sep 30, 2014 6:03 pm
Location: San Francisco

Re: Static object not responding to collision at certain ang

Post by drleviathan »

Your question is confusing because static objects never "react" to any collision (they're static!).

Did you mean to say that dynamic objects sometimes don't collide with a rotated static object? If so, I have a theory about what the problem is:

By default Bullet will update the Aabb of ALL objects in the world every frame, however this can be a waste of CPU cycles in those cases where the static objects are never moved. One can use btCollisionWorld::setForceUpdateAllAabbs(false) to disable the default behavior and gain some performance. When this is done then the Aabb's must be manually updated whenever a static object is moved. Call btCollisionWorld::updateSingleAabb(btCollisionObject* colObj) explicitly after each move.

The symptom when the Aabb is not updated properly is that collisions may fail sometimes where the static object protrudes outside its old Aabb, but will succeed in other places where the old Aabb still overlaps it in its new position. What's really happening is: the broadphase collision filter (which uses Aabb overlap tests) will sometimes fail to pass the collision possibility to the narrowphase collision check.

If that is NOT your problem you'll have to clarify what you mean by "static objects that react to collisions".
Zaladen
Posts: 25
Joined: Thu May 14, 2015 10:21 am

Re: Static object not responding to collision at certain ang

Post by Zaladen »

Yea sorry, what I meant to say was that other objects don't react to the static object. Anyways, thanks for the advice! That sounds like a possible cause of the problem, I'll definitely try that out!
Zaladen
Posts: 25
Joined: Thu May 14, 2015 10:21 am

Re: Static object not responding to collision at certain ang

Post by Zaladen »

Unfortunately that didn't work. What's strange is that collisions work in the X axis, and Y axis but not in the Z axis, and it only applies to shapes in a vertical position. Any help? :/

Ok an update; don't know if it's related but it seems I can't apply forces or impulses in the Z axis either. I have used SetLinearFactor(btVector(1,1,1)).
Zaladen
Posts: 25
Joined: Thu May 14, 2015 10:21 am

Re: Static object not responding to collision at certain ang

Post by Zaladen »

Anyone who has any suggestions? I'm completely stuck with this. :/ The part that also annoys me is the fact that forces and impulses can't be applied in the z axis either, and I wonder if it might be related somehow. I mean, it's a very strange problem to have right?
Zaladen
Posts: 25
Joined: Thu May 14, 2015 10:21 am

Re: Static object not responding to collision at certain ang

Post by Zaladen »

Ok I know I have bumped this thread already, but I really need some suggestions to help me solve this. :S Is it possible that there is some setting in bullet that would disable forces in an axis except setLinearFactor()?
Zaladen
Posts: 25
Joined: Thu May 14, 2015 10:21 am

Re: Static object not responding to collision at certain ang

Post by Zaladen »

Ok I finally solved the problem! It was a stupid mistake on my behalf, I had mistakenly left a line that set the linear factor to (1,1,0), and therefore collisions in the z axis weren't calculated.