Page 1 of 1

Trying to make "sticky" pyramids

Posted: Sat Sep 30, 2017 6:57 pm
by macsforme
I am trying to replicate the physics of BZFlag in a test program using Bullet. In BZFlag, when the tank comes in contact with a pyramid (which is one of the basic world shapes), the tank "sticks" to it, in that you can't climb it or slide down from it; you can only drive away from it or rotate your tank so you're no longer in contact with it. However, if you're on the ground, you can still slide along the base of the pyramid, and if you're stuck the pyramid you can still jump straight up in the air. Here is a video which illustrates the behavior I'm trying to replicate:

My tank shape is a btBoxShape, and I use a btConvexHullShape for the pyramids. The tank motion is very basic, so I just call setLinearVelocity() and setAngularVelocity() on the tank rigid body each time I check user input. Right now, when I apply force to the tank against the pyramid, it pushes the tank way up in the air.

I'm looking for a way to make pyramids behavior in such a manner. As I was brainstorming, I thought I might be looking for something to do with friction, but I'm at a bit of a loss. Any ideas on whether I could replicate this behavior in Bullet?

This topic has my source code if that would help.