setGroup missing

M@gg!

09-08-2006 12:00:58

In the header of body is a function "setGroup" defined, but it is missing in the cpp file.

Why?

(CVS Version)

betajaen

09-08-2006 12:46:35

I probably forgot to put it in. It's in my copy of NxOgre though:

void body::setGroup(group *_group) {
mActor->setGroup(_group->getGroupID());
}

M@gg!

09-08-2006 15:55:24

*LOL*

THX a lot.

But still you forgot something. You'll have to include the "nxOgre_group.h".


Ok, next problem. In "nxOgre_group.cpp" the declaration of "setCollisionWith" is missing.

Best regards,
M@gg!

betajaen

09-08-2006 17:43:35

Hmm, you are right.

Here is a copy of the group code and header anyway.

group.cpp
namespace nxOgre {

group::group(Ogre::String _name, unsigned int _group_id, nxOgre::scene *_scene) {
mName = _name;
mGroupID = _group_id;
mScene = _scene;
}

unsigned int group::getGroupID() {
return mGroupID;
}

void group::setCollisionCallbackWith(group *_group) {
mScene->mScene->setActorGroupPairFlags(mGroupID,_group->getGroupID(), NX_NOTIFY_ON_START_TOUCH | NX_NOTIFY_ON_END_TOUCH /* | NX_NOTIFY_ON_TOUCH --- Temp */);
mScene->mScene->setActorGroupPairFlags(_group->getGroupID(), mGroupID, NX_NOTIFY_ON_START_TOUCH | NX_NOTIFY_ON_END_TOUCH /* | NX_NOTIFY_ON_TOUCH --- Temp */);
}

void group::noCollisionsWith(nxOgre::group *_group) {
mScene->mScene->setGroupCollisionFlag(mGroupID,_group->getGroupID(), false);
}

}


group.h
namespace nxOgre {


class _nxOgreExport group {

friend scene;

public:

unsigned int getGroupID();

void setCollisionCallbackWith(group *_group);
void removeCollisionCallbackWith(group *_group);
void noCollisionsWith(group *_group);

protected:

group(Ogre::String _name, unsigned int _group_id, scene *_scene);

unsigned int mGroupID;
Ogre::String mName;
scene *mScene;

};

}

M@gg!

10-08-2006 12:02:16

Hy,

it's again me. Thx for the fix. Haven't jet tested it, because actually I changed the focus.

Now I'm missing the "findBody" declaration. I realy need it!

THX

PS: When do you intend to release a new CVS Version?

betajaen

10-08-2006 12:50:37

Tommorow.

I can post findBody now if you like, unless you want to wait?

M@gg!

10-08-2006 15:16:49

Tommorow.

Nice! :D

I can post findBody now if you like, unless you want to wait?

Yea, I'm a litle bit impatient. I'd be happy if you'll post it today.

betajaen

10-08-2006 16:51:39

You're like a kid at Christmas :)

body* scene::findBody(Ogre::String _body) {

nxOgre::bodyIterator* it = new bodyIterator(this);

while( body* b = it->next()) {
if (b->getName() == _body)
delete it;
return b;
}

delete it;
return false;
}

M@gg!

11-08-2006 02:57:42

You're like a kid at Christmas :)

Sorry, time is runing like sand through my hands. :?

I'm very happy, that you are a real fast one in posting :!:

M@gg!

11-08-2006 08:53:36


body* scene::findBody(Ogre::String _body) {

nxOgre::bodyIterator* it = new bodyIterator(this);

while( body* b = it->next()) {
if (b->getName() == _body)
delete it;
return b;
}

delete it;
return false;
}




I've been thinking a litle bit about your function. I think it could be done much fast.

In the worst case, you'll have to compare the names of all bodys in your scene with the given name. (even with 1000 object a time consuming task)

What do you think of the idea to build a hash table for faster search operations?

When I'm done with my current project, I'd been interested to implement it.

betajaen

11-08-2006 10:38:15

I did used to use hash tables (maps) for the body pointer storage, but for some reason I switched over to vectors again. I think it was due that I couldn't iterate through them properly and delete specific bodies without it crashing.

I can switch back quite easily though. :D

M@gg!

11-08-2006 11:00:20

I can switch back quite easily though. :D

When you want my support, just say so. I can be of some help after the 25.08. .

betajaen

11-08-2006 11:25:56

I'm good thanks. :D

Ogre uses the std::map system with Scene Nodes. I can just look at that and see how Sinbad & Co. have implemented it.

Shouldn't be to difficult.