[bleeding]ActorGroups

gugus

17-05-2008 13:18:05

I noticed few things that could be bugs.
When you do this:
mGroup->setCallback<T>(this,&T::A,&T::B,&T::C,true);
It gave error on NxOgreGroups.h at ligne 176. I am not at ease with template and i could not manage to get ride of this error.

And i noticed something else,there is no ContactStream* in void (T::*Start)(Actor*, Actor*)
Whats contacStream?

Thanks.

betajaen

17-05-2008 13:22:30

Ugh. I hate template programming sometimes. ContactStream, is just a list of contact points/normals/etc when two actors engage in contact. It was added to NxOgre a few revisions ago.

I'll try and replicate the problem and come up with a fix.

[edit]

Try this; For every "Actor*, Actor*" (there should be 6 of them) in NxOgreGroups.h change to "Actor*, Actor*, ContactStream*".

gugus

17-05-2008 13:26:28

:shock: :shock: 6mn!that was fast :D
Thanks!

betajaen

17-05-2008 13:29:19

My record is less than a minute. Anyway, try the fix I put in my edit there.

gugus

17-05-2008 14:30:56

well,that's the first thing i tried,and it doesn't fix the bug.
Edit:I manage to get it work,i applied a few changes:

line 105:new code
template <typename T> explicit
GroupCallback(T* v,
void (T::*Start)(Actor*, Actor*, ContactStream*),//!
void (T::*End)(Actor*, Actor*, ContactStream*),//!
void (T::*Touch)(Actor*, Actor*, ContactStream*),//!
bool callbackOwned)//Add This!
: mCallback(new TriMethodCallback<T>(v, Start, End, Touch)),mCallbackOwned(callbackOwned) {}//remove the 5th parameters of TriMethodCallbac

line 166:new code:
template <typename T>
void setCallback(
T* v,
void (T::*Start)(Actor*,Actor*, ContactStream*), //!
void (T::*End)(Actor*,Actor*, ContactStream*),//!
void (T::*Touch)(Actor*,Actor*, ContactStream*),//!
bool ownCallback = true
)
{
NxDelete(mCallback);
mCallback = new GroupCallback(v, Start, End, Touch, ownCallback);//add ownCallback
}


But still,i don't understand why we put this:
mCallback = new GroupCallback(v, Start, End, Touch, ownCallback);//add ownCallback
instead of this:
mCallback = new GroupCallback<T>(v, Start, End, Touch, ownCallback);//add ownCallback

betajaen

17-05-2008 14:38:46

Thanks. I'll put it in now. As for your question, the constructor is "explicit" so it guesses the type of classes used. So there is no need for "<T>", its a very handy feature of C++.

gugus

17-05-2008 15:02:32

ahhhhhhh,that's why i didn't manage to get ride of it first,as i put a <T>. I will know it for now.Thanks.