void Actor::ShowCertainBone(const Ogre::String& strBone) { if (!_bShowBone) { return; } SkeletonInstance* pSkeletonInstance = _pBodyEntity->getSkeleton(); if (!pSkeletonInstance) { return; } Bone* pBone = pSkeletonInstance->getBone(strBone); if (!pBone) { return; } if (_axesBoneTagPoint) _pBodyEntity->detachObjectFromBone(_axesBoneEntity); _axesBoneTagPoint = _pBodyEntity->attachObjectToBone(pBone->getName(), _axesBoneEntity); _axesBoneTagPoint->setScale(_scaleAxes, _scaleAxes, _scaleAxes); //OgreFramework::getSingleton().m_pLog->logMessage(strBone); }
void AIHandlerBattleSphere::init() { time = 0; hasTarget = false; guardPos = aiComp->object->position; desiredHeading = Vector3::NEGATIVE_UNIT_Z; angularVelocity = btVector3(0, 0, 0); fireDelay = 0; shotsUntilReload = BATTLE_SPHERE_SHOTS_UNTIL_RELOAD; // Get the physics component and disable deactivation on the rigid body ComponentPhysics* physComp; aiComp->object->sendGetMessage(COMPMSG_GET_PHYSICS_COMPONENT, &physComp); aiComp->rigidBody->setActivationState(DISABLE_DEACTIVATION); // Initialize class to find neighbours neighbours = new AIGetNeighbours(BATTLE_SPHERE_NEIGHBOUR_RADIUS, aiComp->object, OBJTAG_BULLET); // Initialize movement controller movementController = new AIMovementController(BATTLE_SPHERE_MAX_FORCE, BATTLE_SPHERE_MAX_SPEED, physComp, neighbours); movementController->setNoProgressTimeout(BATTLE_SPHERE_NO_PROGRESS_TIMEOUT); movementController->arriveDeceleration = BATTLE_SPHERE_ARRIVE_DECELERATION; movementController->weightArrive = BATTLE_SPHERE_WEIGHT_ARRIVE; movementController->weightWallAvoidance = BATTLE_SPHERE_WEIGHT_WALL_AVOIDANCE; movementController->weightSeparation = BATTLE_SPHERE_WEIGHT_SEPARATION; // Start with "guard" state stateMachine = new AIStateMachine<AIHandlerBattleSphere>(this); stateMachine->changeState(new AIStateBattleSphereGuard()); // Initialize perception perception = new AIPerception(OBJTAG_AGENT, BATTLE_SPHERE_VIEW_RANGE, Degree(BATTLE_SPHERE_FIELD_OF_VIEW), BATTLE_SPHERE_MEMORY_SPAN, aiComp->object); perceptionTimer = new JitteredIntervalTimer(1.0f / 3.0f); // Check if the mesh has a "Fly" animation ComponentMesh* mesh = aiComp->object->mesh; if (mesh) { SkeletonInstance* sk = mesh->entity->getSkeleton(); // Set all bones to "manually controlled" if (sk) { for (int b = 0; b < (int)sk->getNumBones(); ++b) sk->getBone(b)->setManuallyControlled(true); // TODO: move the hasAnim variable(s) into the template, initialize them upon creation of first instance hasAnimFly = sk->hasAnimation(animStringFly); } } }