NxOgreCharacterController bug. [NxOgre 0.9-28]

Lexx

06-07-2007 04:59:31

Tonight i got updated version of NxOgre (updated from 0.9_23 to 0.9_28), and i think, i'm found a bug in NxOgreCharacterController class:

// version 0.9-23

// file NxOgreActor.cpp
void Actor::_createActor(ShapeDescription *shape, const Pose& pose, ActorParams params) {
...
ad.userData = this;
mActor = mOwner->mScene->createActor(ad);
...
}

//file NxOgreCharacterController.cpp
NxControllerAction CharacterController::onShapeHit(const NxControllerShapeHit &hit) {
...
Actor* actor = static_cast<Actor*>(hit.shape->getActor().userData);
...
}
// everything fine, everyone happy

and

// version 0.9-28

// file NxOgreActor.cpp
void Actor::_createActor(ShapeDescription *shape, const Pose& pose, ActorParams params) {
...
mNxActorUserData = new NxActorUserData(this, NxActorUserData::T_Actor);
ad.userData = mNxActorUserData; // user data object was changed to NxActorUserData
mActor = mOwner->mScene->createActor(ad);
...
}

//file NxOgreCharacterController.cpp
NxControllerAction CharacterController::onShapeHit(const NxControllerShapeHit &hit) {
...
Actor* actor = static_cast<Actor*>(hit.shape->getActor().userData); //invalid actor pointer
...
}


my solution to solve this problem:
in file NxOgreCharacterController.cpp
added :

#include "NxOgreUserData.h" // For NxActorUserData for NxActor

and changed :

NxControllerAction CharacterController::onShapeHit(const NxControllerShapeHit &hit) {
...
//Actor* actor = static_cast<Actor*>(hit.shape->getActor().userData); //invalid actor pointer
Actor* actor = (static_cast<NxActorUserData*>(hit.shape->getActor().userData))->toActor();
...
}


is it bug? or something else?

betajaen

06-07-2007 08:15:29

I already spotted it, and posted the same fix in the 0.9 thread. ;)

Lexx

06-07-2007 10:19:14

archhhh.... Search could save my time... :(