Quivering Meshes and Falling Through the Level

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Helderash
Posts: 49
Joined: Sun Mar 25, 2007 8:41 pm

Quivering Meshes and Falling Through the Level

Post by Helderash »

Hi folks!

I've a very simple level setup at the moment. The player has an FPS style camera, is stood in a large room with a cube at the centre (the idea is the player throws rocks at the deformable cube, for a deformation project). I have recently noticed that all of the meshes are quivering slightly in the y-direction. It's only slight at first, but the more I move around the level the greater the quivering gets, and finally the player camera begins to hop up and down furiously before falling through the level.

I'm guessing it's something to do with the collision detection between the player and the level itself (causing the player to "quiver" his way through the base). My current collision code is as follows:

Code: Select all

IAnimatedMesh* mesh = smgr->getMesh("collisionplayroom.b3d");
ISceneNode* node = 0;

if (mesh)
    node = smgr->addOctTreeSceneNode(mesh->getMesh(0));

ITriangleSelector* selector = 0;

if (node)
{
        node->setPosition(vector3df(-16,0,0));
        selector = smgr->createOctTreeTriangleSelector(mesh->getMesh(0), node, 128);
        node->setTriangleSelector(selector);
        selector->drop();
}

m_cam = smgr->addCameraSceneNodeFPS(0,100,30);
m_cam->setPosition(vector3df(-20,7,0));
m_cam->setTarget(vector3df(50, 0, 0));

ISceneNodeAnimator* anim = smgr->createCollisionResponseAnimator(
    selector, m_cam, vector3df(2,3,2),
    vector3df(0,-10,0),
    vector3df(0,3,0));

m_cam->addAnimator(anim);
anim->drop();
Have I done something incorrect here, or does the problem seem to be coming from elsewhere? Thankyou for any help.. this one really is confusing me!
Helderash
Posts: 49
Joined: Sun Mar 25, 2007 8:41 pm

Post by Helderash »

I seem to have found the source of the problem, but not a solution. As well as the selector mentioned below, I have a second to deal with cube collisions, setup as follows:

Code: Select all

selector2 = smgr->createOctTreeTriangleSelector(cubeMesh, cubeSceneNode, 128);
cubeSceneNode->setTriangleSelector(selector2);
selector2->drop();

ISceneNodeAnimator* anim = smgr->createCollisionResponseAnimator(
selector, m_cam, vector3df(2,3,2),vector3df(0,-10,0),vector3df(0,3,0));

ISceneNodeAnimator* anim2 = smgr->createCollisionResponseAnimator(
selector2, m_cam, vector3df(2,3,2),vector3df(0,-10,0),vector3df(0,3,0));

m_cam->addAnimator(anim);
m_cam->addAnimator(anim2);

anim->drop();
anim2->drop();
Removing the second animator, "anim2" removes the problem, but also disables collision detection with my cube. Will I have to mount a second node to my cam node for collision detection with the cubic mesh?
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

add both selectors into a metaSelector, then use that in the collision response animator. you shouldn't use two collision response animators on one node.
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
Helderash
Posts: 49
Joined: Sun Mar 25, 2007 8:41 pm

Post by Helderash »

That worked perfectly, thanks bitplane!

I seem to only have one visual problem left now. If I form my deformable cube mesh from anymore than 27 vertices, looking upwards causes the bottom of the mesh to appear invisible. Looking back down again will cause the bottom of the mesh to pop back into view. This occurs in both windowed and full screen modes. Any idea what could be causing this one?
Helderash
Posts: 49
Joined: Sun Mar 25, 2007 8:41 pm

Post by Helderash »

I seem to have fixed the last problem - I believe my mesh normals weren't quite correct.
Post Reply