[Solved] Grab a box with a cursor?

User avatar
jubei
Posts: 11
Joined: Sun Jul 24, 2011 9:29 am

[Solved] Grab a box with a cursor?

Post by jubei »

Hello. I am trying to make a spherical cursor that will penetrate boxes, pick them up and move them around.

I have managed to iterate through the manifolds , get what object my cursor is penetrating and make a constraint but the picked up box keeps spinning around like crazy (i think it keeps receiving collisions from my cursor)

How can I:
  • a) Stop my spherical cursor from bumping against other objects (I have tried ->setFlags(btCollisionObject::CO_GHOST_OBJECT) or ->setFlags(btCollisionObject::CF_NO_CONTACT_RESPONSE), neither seems to work)
    b) Stop the object from spinning as soon as I pick it up. I imagine if I can achieve the 1st , the 2nd part will also be solved.
I am really confused although I read the manual as to if my cursor should be a kinematic object or a ghost object or.. dunno. I'm confused :)

Any help would be appreciated,

Jubei
Last edited by jubei on Tue Jul 26, 2011 1:13 am, edited 2 times in total.
Mako_energy02
Posts: 171
Joined: Sun Jan 17, 2010 4:47 am

Re: Grab an object

Post by Mako_energy02 »

Two things come to mind. First...the flag "btCollisionObject::CO_GHOST_OBJECT" is not a valid flag you can pass into "setFlags()". It's an enum value for the internal type, rather then the settings the types can have. "btCollisionObject::CF_NO_CONTACT_RESPONSE" however is a valid flag and it should work to do what you want it to, provided other parts of the configuration are correct. Which leads me to the second thing.

Are you setting the internal ghost callback when constructing the world? Here's a snippet from my code:

Code: Select all

this->GhostCallback = new btGhostPairCallback();
this->BulletBroadphase->getOverlappingPairCache()->setInternalGhostPairCallback(GhostCallback);
Without it, ghost objects will not work the way they are meant to.
User avatar
jubei
Posts: 11
Joined: Sun Jul 24, 2011 9:29 am

Re: Grab an object

Post by jubei »

Thank you for your response, I set btCollisionObject::CF_NO_CONTACT_RESPONSE to my kinematic rigidbody but It does not show up in the Manifold List like before the flag.

I'm using OgreBullet, a wrapper which doesn't have a ghost object (OgreBullet doesn't support Ghost Objects and if I make the ghost object myself, manually updating it's world transform everytime the Ogre Node moves has no effect).

Furthermore, is it possible to make a constraint between a ghost object and another rigid body?

Jubei

EDIT: erwin talks about a "don't collide flag" for objects involved in a constraint here: http://www.bulletphysics.org/Bullet/php ... 3030#p3030 but I haven't found anymore info on it.
User avatar
jubei
Posts: 11
Joined: Sun Jul 24, 2011 9:29 am

Re: [Solved] Grab a box with a cursor?

Post by jubei »

Bullet seemed to ignore my "CF_NO_CONTACT_RESPONSE" flag because I was setting it like this:

Code: Select all

myRigidBody->setCollisionFlags(btCollisionObject::CF_NO_CONTACT_RESPONSE);
It worked when I set it like this:

Code: Select all

myRigidBody->setCollisionFlags(myRigidBody->getCollisionFlags() ^ btCollisionObject::CF_NO_CONTACT_RESPONSE);