two box collision problem

NxOgre

17-10-2008 08:18:07

//

i want see two boxes collision,but it not work.

this is my code:

:( :( class myCallback : public GroupCallback::InheritedCallback {

public:

void onStartTouch(NxOgre::Actor*, NxOgre::Actor*) {}

void onEndTouch(NxOgre::Actor*, NxOgre::Actor*) {}

void onTouch(NxOgre::Actor*, NxOgre::Actor*) {}

};

NxOgre::ActorGroup* actorGroup=mNxScene->createActorGroup("head_one_group");

NxOgre::ActorGroup* actorGroup_two=mNxScene->createActorGroup("head_two_group");

actor=mNxScene->createActor("box", new NxOgre::Cube(1), Vector3(707,500,528), "mass:10,Group:head_one_group");

//first box

NodeRenderableParams nrp;

nrp.setToDefault();

nrp.mIdentifier=headNode->getName();

nrp.mIdentifierUsage=NxOgre::NodeRenderableParams::IU_Use;

body = mPhysiX->mNxScene->createBody("box",new NxOgre::Cube(1),Vector3(707,100,528),nrp,"mass:10");

////////////////////////////////////////////////////////

actor_two=mNxScene->createActor("box_two", new NxOgre::Cube(10), Vector3(707,200,528),"mass:10,Group:head_two_group");

//second box

NodeRenderableParams nr;

nr.setToDefault();

nr.mIdentifier=headNodeTwo->getName();

nr.mIdentifierUsage=NxOgre::NodeRenderableParams::IU_Use;

body_one =mNxScene->createBody("box_two",new NxOgre::Cube(1),Vector3(707,200,528),nr,"mass:10");

myCallback* mCallback=new myCallback();

actorGroup->setCallback(mCallback);
actorGroup->setCollisionCallback(actorGroup_two, NX_NOTIFY_ALL, true);

///////////////////////////////////

i run this program but it not execute the callback method

can any person help me,i come from china,my english is not good

mcaden

17-10-2008 08:34:40

  1. please use [code ] and [/code ] (without the space at the end)[/*:m]
  2. your callback function is empty.[/*:m]
  3. Why are you making a 10-unit large actor cube around your 1 unit large body (a body IS an actor)?[/*:m][/list:o]

    Try this:

    class myCallback : public GroupCallback::InheritedCallback {

    public:

    void onStartTouch(NxOgre::Actor*, NxOgre::Actor*)
    {
    LogManager::getSingleton().logMessage( "-= Entered onStartTouch Callback! =-" );
    }
    void onEndTouch(NxOgre::Actor*, NxOgre::Actor*) {}
    void onTouch(NxOgre::Actor*, NxOgre::Actor*) {}

    };

    NxOgre::ActorGroup* actorGroup = mNxScene->createActorGroup("head_one_group");
    NxOgre::ActorGroup* actorGroup_two = mNxScene->createActorGroup("head_two_group");


    NodeRenderableParams nrp;
    nrp.setToDefault();
    nrp.mIdentifier=headNode->getName();
    nrp.mIdentifierUsage=NxOgre::NodeRenderableParams::IU_Create;

    body = mNxScene->createBody("box;box.mesh",new NxOgre::Cube(1),Vector3(707,100,528),nrp,"mass:10, group: head_one_group");

    ////////////////////////////////////////////////////////

    //second box

    NodeRenderableParams nrp2;
    nr.setToDefault();
    nr.mIdentifier=headNodeTwo->getName();
    nr.mIdentifierUsage=NxOgre::NodeRenderableParams::IU_Create;

    body_one = mNxScene->createBody("box_two;box.mesh",new NxOgre::Cube(1),Vector3(707,200,528),nrp2,"mass:10, group: head_two_group");

    myCallback* mCallback=new myCallback();

    actorGroup->setCallback(mCallback);
    actorGroup->setCollisionCallback(actorGroup_two, NX_NOTIFY_ALL, true);



    I live in China too, but my Chinese is very poor, sorry.

Prophet

17-10-2008 10:29:20

I'd suggest not to call yourself NxOgre...

betajaen

17-10-2008 10:36:00

Yes, very original. Remind me to when I post on a Microsoft forum to use Microsoft as my user name.

Since, you've used it now. I can't use it for official posts. <sigh>

NxOgre

18-10-2008 05:31:23

i am sorry, i don't think about this name which will affect you work.

thanks you reply,wish you help i have solve my problem.