[SOLVED] btKinematicCharController: Behavior on slopes
Posted: Mon Jun 22, 2015 9:43 pm
Hello everyone,
I am using a btKinematicCharacterController to control my player. I've put together a quick video of two small clips:
https://www.youtube.com/watch?v=2GH1YI5B5lU
Edit: I do not care about issue #1 right now.
Clip #1 is an issue I face when I land or stop on seams. The player gets pushed a little bit. Even though the grassy plane is one object in Bullet.
I think it has to do with how I create this object because I am using a btBvhTriangleMeshShape for the plane (and BtOgre, of course). Any advice? It's a small annoyance, but still.
Clip #2 is that the player slides on any slope, even though he can walk them up. How can I avoid that? I want the player to stay at this position if the angle is not too steep.
Any advice?
I am using a btKinematicCharacterController to control my player. I've put together a quick video of two small clips:
https://www.youtube.com/watch?v=2GH1YI5B5lU
Edit: I do not care about issue #1 right now.
Clip #1 is an issue I face when I land or stop on seams. The player gets pushed a little bit. Even though the grassy plane is one object in Bullet.
I think it has to do with how I create this object because I am using a btBvhTriangleMeshShape for the plane (and BtOgre, of course). Any advice? It's a small annoyance, but still.
Code: Select all
Ogre::Plane plane;
plane.normal = Ogre::Vector3::UNIT_Y;
plane.d = 0;
Ogre::MeshManager::getSingleton().createPlane("floor", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, plane, 70.0f, 70.0f, 10, 10, true, 1, 50.0f, 50.0f, Ogre::Vector3::UNIT_Z);
Ogre::Entity* planeEnt = _sceneManager->createEntity("plane", "floor");
planeEnt->setMaterialName("GrassMaterial");
planeEnt->setCastShadows(false);
_sceneManager->getRootSceneNode()->createChildSceneNode()->attachObject(planeEnt);
// physics for plane
BtOgre::StaticMeshToShapeConverter converter3(planeEnt);
_planeShape = converter3.createTrimesh();
_planeMotionState = new btDefaultMotionState();
_planeBody = new btRigidBody(0, _planeMotionState, _planeShape);
_planeBody->setCollisionFlags(COL_STATIC_ENVIRONMENT);
_phyWorld->addRigidBody(_planeBody, COL_STATIC_ENVIRONMENT, CollisionGroups::environmentCollidesWith);
Any advice?