gbisocoli
03-10-2011 21:28:29
Hi, I'm implementing Character Controller (NxOgre + Critter: 1.7.x Buggy Swires) and I'm having trouble with the character, it falls through the ground. Here is part of the code (based on tutorial 1201.h):
Using this:
I create the plane like this:
and the creation of the character is this:
So, this is a little different to the tutorial, for example in the tutorial the floor is created like this:
It seems there are two different floors on the tutorial, is there a way of using just one floor? Like I did? Am I missing something? The character just appears and falls to the ground.
Using this:
enum ControllerShapeGroups
{
NonCollidable = 0, // Things that the character controller can go through such as Ghosts or tiny
// objects like small rocks.
Walls = 1, // Walls, Floors and other static geometry that can't be moved.
Objects = 2 // Boxes, Barrels and other dynamic parts of the scene that can be moved by pushing.
};
I create the plane like this:
NxOgre::PlaneGeometryDescription nxPlaneDesc;
nxPlaneDesc.mGroup= Walls; // for the Character not to fall through the ground.
mNxOgreScene->createSceneGeometry(nxPlaneDesc);
and the creation of the character is this:
HumanPlayerBase(Critter::RenderSystem* rs, NxOgre::Scene* nxos): PlayerBase(rs, nxos)
{
Critter::AnimatedCharacterDescription desc;
desc.mShape = NxOgre::SimpleCapsule(5+0.5+0.1,2);
desc.mCollisionMask = (Walls << 1) | (Objects << 1);
desc.mMaxGroundSpeed = 17.0f;
desc.setJumpVelocityFromMaxHeight(mNxOgreScene->getGravity().y, 0.75f);
mCharacter = mRenderSystem->createAnimatedCharacter(Ogre::Vector3(0,40,0), Ogre::Radian(0), "sinbad.mesh", desc);
mCharacter->setInput(mCharacterInputHelper);
}
So, this is a little different to the tutorial, for example in the tutorial the floor is created like this:
// Fake Floor
BoxDescription fake_floor_desc(250,1,250);
fake_floor_desc.mGroup = Walls;
mScene->createSceneGeometry(fake_floor_desc, Vec3(0,-0.5,0));
[...]
// Plane creation
mScene->createSceneGeometry(NxOgre::PlaneGeometryDescription());
It seems there are two different floors on the tutorial, is there a way of using just one floor? Like I did? Am I missing something? The character just appears and falls to the ground.