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:
and
my solution to solve this problem:
in file NxOgreCharacterController.cpp
added :
and changed :
is it bug? or something else?
// 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?