[SOLVED] After upgrade to Detritus Actors don't collide

Xenomorph

20-02-2011 23:25:41

I had to put my project on hold for a while and just started working on it again a couple of days ago. I updated the NxOgre to the current Detritus version and I had to change a few things to get them to compile correctly. After a few hours of looking into it I finally got the Visual Debugger to work again :) .
I also had to change the way I create Actors. That's where I also have a few questions.
That's how I did it before:

NxOgre::RigidBodyDescription desc;
desc.mName = "Avatar";
desc.mMass = 11100; //normal takeoff weight
desc.mBodyFlags |= NxOgre::Enums::BodyFlags_DisableGravity;
desc.mBodyFlags |= NxOgre::Enums::BodyFlags_FreezeRotation;
//desc.mGroup = 0;
NxOgre::Matrix44 identity44;
identity44.identity();
mActor = DFAData::DFAPhysicsManager::getSingletonPtr()->getScene()->createActor(new NxOgre::Box(6.5, 4, 17), identity44, desc);

That's how I changed it:

NxOgre::RigidBodyDescription desc;
desc.mName = "Avatar";
desc.mMass = 11100; //normal takeoff weight
desc.mRigidbodyFlags |= NxOgre::DynamicRigidbodyFlags::DisableGravity;
desc.mRigidbodyFlags |= NxOgre::DynamicRigidbodyFlags::FreezeRotation;
//desc.mGroup = 0;
NxOgre::Matrix44 identity44;
identity44.identity();
NxOgre::BoxDescription boxDesc;
boxDesc.mSize = Vector3(6.5, 4, 17);
mActor = DFAData::DFAPhysicsManager::getSingletonPtr()->getScene()->createActor(boxDesc, identity44, desc);

I hope that's correct, but now the rigidBodyDescription and the boxDescription both have mMass. Which one am I supposed to use to set the mass?

Also I got the terrain to work properly. Now, when I enable my visualDebugger then all the actors are there and the physics terrain is there as well. The problem now is that they don't collide with each other anymore. Before I updated it all worked fine and everything collided. Do I have to set some flag I don't know about? I thought by default they should collide though.
Any help is highly appreciated.

Thanks!

betajaen

20-02-2011 23:37:06

You should only need to set the Mass on the RigidBody, the mass on the shape is used for multi-shape Actors where one part is heavier than the other.

Your code is fine; although you can use Matrix44::IDENTITY if you wish.

As for collision; Make sure the terrain hole material (in the description) isn't zero, have it something high; like a 1000. I agree though, they should collide.

Xenomorph

21-02-2011 00:21:14

I tried setting the terrainHole value, but nothing changed. It has a default value of like 69535 anyways, so that can't be the problem.
The thing is that it's not only the collision with the terrain that doesn't work, it's also the collision between actors that is not working. Like I said, before I updated to the current version of Detritus the collision worked just fine. Are you sure there is nothing else I have to set?

betajaen

21-02-2011 08:34:21

Have you turned off actor group or shape group collisions in other pieces of code? Or do you have anything else that isn't normal or default?

Xenomorph

21-02-2011 22:56:26

I found out what the problem was. Instead of using the mRigidBodyFlags
desc.mRigidbodyFlags |= NxOgre::DynamicRigidbodyFlags::DisableGravity;
desc.mRigidbodyFlags |= NxOgre::DynamicRigidbodyFlags::FreezeRotation;

I had to use mDynamicRigidBodyFlags
desc.mDynamicRigidbodyFlags |= NxOgre::DynamicRigidbodyFlags::DisableGravity;
desc.mDynamicRigidbodyFlags |= NxOgre::DynamicRigidbodyFlags::FreezeRotation;


That solved the problem and everything is colliding again.