How to modify a ISceneNodeAnimatorCollisionResponse

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
benjani13
Posts: 25
Joined: Sat Aug 07, 2010 8:12 pm

How to modify a ISceneNodeAnimatorCollisionResponse

Post by benjani13 »

Hello, I'd like to know how to modify a parameter of a
ISceneNodeAnimatorCollisionResponse during the rendering loop.
When I try to keep the pointer on the animator, and modify a parameter during the render loop like that:

Code: Select all

animPointer->setGravity(core::vector3df(0, -10, 0));
, the animator doesn't work anymore.

Thank you if you have an idea.
benjani13
Posts: 25
Joined: Sat Aug 07, 2010 8:12 pm

Post by benjani13 »

None have an idea? :(
serengeor
Posts: 1712
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Post by serengeor »

1)What do you mean doesn't work?
2)Have you called:

Code: Select all

animPointer->drop();
before:

Code: Select all

animPointer->setGravity(core::vector3df(0, -10, 0));
?
Working on game: Marrbles (Currently stopped).
benjani13
Posts: 25
Joined: Sat Aug 07, 2010 8:12 pm

Post by benjani13 »

1) I mean no collisions and no gravity, like if the collision animator doesn't exist anymore.
2) No I haven't called drop()

I create the collision animator like that:

Code: Select all

scene::ISceneNodeAnimatorCollisionResponse* playerAnim;
if (selector)
{
    playerAnim = smgr->createCollisionResponseAnimator(selector, playerNode, 
                                                core::vector3df(20, 40, 10),
                                                core::vector3df(0, -10, 0), 
                                                core::vector3df(0, 18, 0));
    playerNode->addAnimator(playerAnim);
}
And this is my render loop:

Code: Select all

while(device->run())
{
    if(device->isWindowActive())
    {
        driver->beginScene(true, true, 0);
        smgr->drawAll();
        gui->drawAll();

            
        // Change Gravity --------------------------------------
        playerAnim->setGravity(core::vector3df(0, 10, 0)); //If this works, the playerNode should fly
        //---------------------------------------------------------
            

        time = (f32)device->getTimer()->getTime();
            
        eventReceiver.updateNodePosition(time - lastTime);
        eventReceiver.replaceCamera();
        eventReceiver.pickSceneNode();

        if(time - lastTime < MIN_FRAME_TIME)
        {
            device->sleep((u32)(MIN_FRAME_TIME - (time - lastTime)));
        }
        else
        {
            lastTime = time;
        }

        driver->endScene();
    }
    else
    {
        device->sleep(500);
    }
}
Do you see something wrong in my code?
Post Reply