diff --git a/Engine/source/T3D/AI/AIController.cpp b/Engine/source/T3D/AI/AIController.cpp index deb3450b9..3197f3579 100644 --- a/Engine/source/T3D/AI/AIController.cpp +++ b/Engine/source/T3D/AI/AIController.cpp @@ -117,7 +117,7 @@ bool AIController::getAIMove(Move* movePtr) if (getAim()->mObj || getAim()->mPosSet) mMovement.mAimLocation = getAim()->getPosition(); else - mMovement.mAimLocation = mMovement.mMoveDestination; + mMovement.mAimLocation = getNav()->mMoveDestination; mControllerData->resolveYaw(this, location, movePtr); mControllerData->resolvePitch(this, location, movePtr); @@ -232,8 +232,8 @@ void AIControllerData::resolveSpeed(AIController* obj, Point3F location, Move* m // Move towards the destination if (obj->mMovement.mMoveState != AIController::ModeStop) { - F32 xDiff = obj->mMovement.mMoveDestination.x - location.x; - F32 yDiff = obj->mMovement.mMoveDestination.y - location.y; + F32 xDiff = obj->getNav()->mMoveDestination.x - location.x; + F32 yDiff = obj->getNav()->mMoveDestination.y - location.y; Point3F rotation = obj->getAIInfo()->mObj->getTransform().getForwardVector(); // Check if we should mMove, or if we are 'close enough' @@ -246,22 +246,22 @@ void AIControllerData::resolveSpeed(AIController* obj, Point3F location, Move* m { // Build move direction in world space if (mIsZero(xDiff)) - movePtr->y = (location.y > obj->mMovement.mMoveDestination.y) ? -1.0f : 1.0f; + movePtr->y = (location.y > obj->getNav()->mMoveDestination.y) ? -1.0f : 1.0f; else if (mIsZero(yDiff)) - movePtr->x = (location.x > obj->mMovement.mMoveDestination.x) ? -1.0f : 1.0f; + movePtr->x = (location.x > obj->getNav()->mMoveDestination.x) ? -1.0f : 1.0f; else if (mFabs(xDiff) > mFabs(yDiff)) { F32 value = mFabs(yDiff / xDiff); - movePtr->y = (location.y > obj->mMovement.mMoveDestination.y) ? -value : value; - movePtr->x = (location.x > obj->mMovement.mMoveDestination.x) ? -1.0f : 1.0f; + movePtr->y = (location.y > obj->getNav()->mMoveDestination.y) ? -value : value; + movePtr->x = (location.x > obj->getNav()->mMoveDestination.x) ? -1.0f : 1.0f; } else { F32 value = mFabs(xDiff / yDiff); - movePtr->x = (location.x > obj->mMovement.mMoveDestination.x) ? -value : value; - movePtr->y = (location.y > obj->mMovement.mMoveDestination.y) ? -1.0f : 1.0f; + movePtr->x = (location.x > obj->getNav()->mMoveDestination.x) ? -value : value; + movePtr->y = (location.y > obj->getNav()->mMoveDestination.y) ? -1.0f : 1.0f; } // Rotate the move into object space (this really only needs diff --git a/Engine/source/T3D/AI/AIController.h b/Engine/source/T3D/AI/AIController.h index db13b6ee4..bc5ad3a33 100644 --- a/Engine/source/T3D/AI/AIController.h +++ b/Engine/source/T3D/AI/AIController.h @@ -89,7 +89,6 @@ public: Point3F mLastLocation; // For stuck check S32 mMoveStuckTestCountdown; // The current countdown until at AI starts to check if it is stuck Point3F mAimLocation; - Point3F mMoveDestination; // move triggers bool mMoveTriggers[MaxTriggerKeys]; void stopMove(); diff --git a/Engine/source/T3D/AI/AINavigation.cpp b/Engine/source/T3D/AI/AINavigation.cpp index ed0fce56f..d9f4bb3ea 100644 --- a/Engine/source/T3D/AI/AINavigation.cpp +++ b/Engine/source/T3D/AI/AINavigation.cpp @@ -25,6 +25,7 @@ AINavigation::AINavigation(AIController* controller) { mControllerRef = controller; + mJump = None; } NavMesh* AINavigation::findNavMesh() const diff --git a/Engine/source/T3D/player.cpp b/Engine/source/T3D/player.cpp index 4552e5618..42e8a9d5f 100644 --- a/Engine/source/T3D/player.cpp +++ b/Engine/source/T3D/player.cpp @@ -2259,7 +2259,7 @@ void Player::advanceTime(F32 dt) } } -bool Player::setAIController(const char* controller) +bool Player::setAIController(S32 controller) { if (Sim::findObject(controller, mAIController)) { @@ -2271,7 +2271,7 @@ bool Player::setAIController(const char* controller) return false; } -DefineEngineMethod(Player, setAIController, bool, (const char* controller), , "") +DefineEngineMethod(Player, setAIController, bool, (S32 controller), , "") { return object->setAIController(controller); } diff --git a/Engine/source/T3D/player.h b/Engine/source/T3D/player.h index 78367edab..752ea9ca1 100644 --- a/Engine/source/T3D/player.h +++ b/Engine/source/T3D/player.h @@ -763,7 +763,7 @@ public: void setMomentum(const Point3F &momentum) override; bool displaceObject(const Point3F& displaceVector) override; virtual bool getAIMove(Move*); - bool setAIController(const char* controller); + bool setAIController(S32 controller); AIController* getAIController() { return mAIController; }; bool checkDismountPosition(const MatrixF& oldPos, const MatrixF& newPos); ///< Is it safe to dismount here?