I want two box collison then one of the boxes back.

whw

18-10-2008 16:15:14

can any people who have once face the same problem help me ?

spacegaier

18-10-2008 18:59:30

Sorry, but I don't understand what is your problem?

If you create two boxes (two instances of NxOgre::Actor)and let them collide, the will react physically correct.

whw

19-10-2008 05:54:47

yes I create two actors,i also can cheak they collision,but without physic react

spacegaier

19-10-2008 10:41:56

Could you show us your code? I don't understand why they should not react correctly. And perhaps a short video to underline your problem (if possible).

whw

20-10-2008 01:04:19

//create world
PhysXParams params;
params.mUseLog=true;
params.mTimeController = PhysXParams::TC_OGRE;
mWorld= new World(params);
//create scene
SceneParams sp;
sp.setToDefault();
sp.mDefaultMaterial.mDynamicFriction = 0.5; sp.mDefaultMaterial.mStaticFriction = 0.75;
sp.mDefaultMaterial.mRestitution = 0.0;
sp.mFloor =true;
Real gmultiplier = 2.0f;
sp.mGravity.set( 0.0, gmultiplier * -9.80665, 0.0 );
sp.mMaxTimestep = 1.0 / 60.0;
sp.mMaxIterator = 8;
sp.mController = NxOgre::SceneParams::CN_ACCUMULATOR;
sp.mRenderer = NxOgre::SceneParams::RN_OGRE;
mNxScene=mWorld->createScene("NxOgreScene", sceneMgr,sp);

//this is my collision callback
class MyCallback : public GroupCallback::InheritedCallback {
public:
void onStartTouch(NxOgre::Actor*, NxOgre::Actor*,ContactStream* )
{
}
void onEndTouch(NxOgre::Actor*, NxOgre::Actor*,ContactStream*)
{
}
void onTouch(NxOgre::Actor*, NxOgre::Actor*,ContactStream*)
{
}

};

//create body
NxOgre::ActorGroup* actorGroup=mPhysiX->mNxScene->createActorGroup("head_one_group");
NxOgre::ActorGroup* actorGroup_two=mPhysiX->mNxScene->createActorGroup("head_two_group");
//first head
NodeRenderableParams nrp;
nrp.setToDefault();
nrp.mIdentifier=headNode->getName();
nrp.mIdentifierUsage=NxOgre::NodeRenderableParams::IU_Use;
nrp.mMode = RenderableSource::RM_Interpolate;
body = mPhysiX->mNxScene->createBody(nrp.mIdentifier,new NxOgre::Sphere(ogreHead->getBoundingRadius()),Vector3(707,100,528),nrp,ActorParams("mass:10,Group:head_one_group"));

//second head
NodeRenderableParams nr;
nr.setToDefault();
nr.mIdentifier=headNodeTwo->getName();
nr.mIdentifierUsage=NxOgre::NodeRenderableParams::IU_Use;
body_one = mPhysiX->mNxScene->createBody(nr.mIdentifier,new NxOgre::Sphere(ogreHeadTwo->getBoundingRadius()),Vector3(707,200,528),nr,"mass:10,Group:head_two_group");

//set callback

MyCallback* mCallback=new MyCallback();
actorGroup->setCallback(mCallback);
actorGroup->setCollisionCallback(actorGroup_two, NX_NOTIFY_ALL, true);

// the test result

I can cheack the two heads collsion but I can't see the up head rebound :

spacegaier

20-10-2008 08:04:33

I'm not totaly sure, but leave out the actor groups, just for testing.

I'll test it own my own this evening when I'm at home.

PS: And please edit you last post, so that the code is surrounded with [code ] fasdlkfjalsdkfj [/code ] (without the blanks).