Paweł Mogiła's game development blog

ropes and ladders October 12, 2011

Filed under: gamedev,videos — szaman @ 09:49

I specialized a new type of object, that allows to stick on it. After physics tick if player wants to catch object, I’m looking on his physics object contact points and simply if there is something to grab – just stick together by adding suitable constraint in right place. When player is sticking something then I unlock his jump possibility, which gives ability to climb. In the video bellow you can see two climbing/sticking models, and as you probably noticed they are not behaving in typical way. I mean specifically that they don’t collide with other objects (especially with player)

in bullet, for turning off collisions per object you can do such things:

  • specify collision group and collision mask while adding object to the world via
btDynamicsWorld::addRigidBody (btRigidBody *body, short group, short mask)

but this is not the way, I use for my ropes, because it prevents collision in very early stage and contact points are not generated for these objects

  • set CF_NO_CONTACT_RESPONSE  flag while constructing body
mBody->setCollisionFlags(mBody->getCollisionFlags() |   btCollisionObject::CF_NO_CONTACT_RESPONSE));

contact points will be generated,  so if you don’t need them use previous method because of performance. My sticking objects use this method to let know about ability to grab

Advertisements
 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s