Physics Simulation Forum

 

All times are UTC




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Sun Mar 19, 2017 7:56 pm 
Offline

Joined: Sun Mar 19, 2017 7:51 pm
Posts: 3
I'm using Urho3D and have some box shaped objects. All of them have a rigid body and a collision shape (also a box).
As long as the masses of my objects is set to zero, the objects don't collide.
I'm not sure if what I'm trying to do is possible with the Bullets library, but my intention was to use it purely for collision detection and not for any kind of physics simulation.

What's the right way of solving this?


Top
 Profile  
 
PostPosted: Sun Mar 19, 2017 8:07 pm 
Offline

Joined: Thu Apr 14, 2016 3:44 pm
Posts: 44
try btCollisionWorld::contactPairTest ? or you can perform a convexSweepTest. More details about what you want collision but not physics for could help.


Last edited by ktfh on Sun Mar 19, 2017 8:10 pm, edited 1 time in total.

Top
 Profile  
 
PostPosted: Sun Mar 19, 2017 8:10 pm 
Offline

Joined: Sun Mar 19, 2017 7:51 pm
Posts: 3
Are you proposing that I should manually try to detect collision wit all potential bodies? That sounds wrong.

Meanwhile I found that my bodies should be kinematic and not dynamic. So I changed them. Still I don't get any collision callbacks.


Top
 Profile  
 
PostPosted: Sun Mar 19, 2017 8:11 pm 
Offline

Joined: Thu Apr 14, 2016 3:44 pm
Posts: 44
Krumelur wrote:
Are you proposing that I should manually try to detect collision wit all potential bodies? That sounds wrong.

Meanwhile I found that my bodies should be kinematic and not dynamic. So I changed them. Still I don't get any collision callbacks.

static and kinematic objects cant collide with each other. Could you provide more details about what your trying to achieve ?


Top
 Profile  
 
PostPosted: Sun Mar 19, 2017 8:21 pm 
Offline

Joined: Sun Mar 19, 2017 7:51 pm
Posts: 3
Sure, let me try.

I have a simple scene in Urho3D without any physics going on. The player can move an object around (a cube) and is supposed to "collect" items which are not moved by physics but change their positions randomly.

Urho3D is using Bullet to simulate physics. If I know add a rigid body and a collision shape (box) to the player and the collectible objects, everything starts dropping down, thanks to gravity and the mass of the objects. Also, the objects influence each other by colliding and change positions due to the forces applied to them. Nothing of this behaviour is what I want for this simple demo game, except the fact the collisions are detected: Urho3D reports all collisions detected by Bullet back to me in a callback.

So I set the mass of my objects to 0 to prevent them from falling. But this disabled collision detection (and I presume that's a feature/behaviour of Bullet and not Urho3D; please correct me if I'm wrong).

Next thing I found: Bullet supports kinematic bodies. I read about tose and figured that's what I want. My player object and the collectibles should be of this type but still, if the collision shapes clearly overlap, I'm not informed about the collision.

Does that help to make it clearer?

EDIT: I noticed that the collision shapes seem to be inactive (the debug renderer changes their color from white to green). So I tried and made the player a dynamic object with mass and disabled gravity on the scene. Now if the player is moving, it will collide with the other kinematic objects but with all the effects described above, meaning physical force will be applied to it and it will bounce off the other objects.


Top
 Profile  
 
PostPosted: Sun Mar 19, 2017 8:46 pm 
Offline

Joined: Thu Apr 14, 2016 3:44 pm
Posts: 44
You could implement this with a btGhostObject, they maintain an array of overlapping objects, I think you would still have to perform a contactPairTest for each overlapping object to get btManifoldPoint where they touch.

You might also find the btKinematicCharacterController useful too
http://bulletphysics.org/Bullet/BulletF ... oller.html


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 14 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