void CC3ActionMoveDirectionallyBy::update( float t ) { GLfloat deltaTime = t - m_prevTime; GLfloat deltaDist = m_distance * deltaTime; CC3Vector moveDir = getTargetDirection().normalize(); CC3Vector prevLoc = getTargetNode()->getLocation(); getTargetNode()->setLocation( prevLoc.add( moveDir.scaleUniform(deltaDist) ) ); m_prevTime = t; /*LogTrace(@"%@: time: %.3f, delta time: %.3f, delta dist: %.3f, was at: %@, now at: %@", self, t, deltaTime, deltaDist, NSStringFromCC3Vector(prevLoc), NSStringFromCC3Vector(self.targetCC3Node.location));*/ }
void CC3ActionRotateByAngle::update( float t ) { GLfloat deltaTime = t - m_fPrevTime; GLfloat deltaAngle = m_diffAngle * deltaTime; getTargetNode()->rotateByAngle( deltaAngle, m_activeRotationAxis ); m_fPrevTime = t; }
OgreCharacterController::OgreCharacterController(Ogre::Camera * Camera, const Ogre::String& name, const Ogre::Vector3& position) : CharacterController(Camera, position, name, "Sinbad.mesh", Ogre::Vector3(3, 3, 3)), lastTop(0), lastBase(0), mSword1(0), mSword2(0), swordsOut(false), sliceDir(false), animTimer(0) { Ogre::SceneManager * smgr = Camera->getSceneManager(); Ogre::Entity * ent = getEntity(); ent->getSkeleton()->setBlendMode(Ogre::ANIMBLEND_CUMULATIVE); mSword1 = smgr->createEntity("Sword1", "Sword.mesh"); mSword2 = smgr->createEntity("Sword2", "Sword.mesh"); ent->attachObjectToBone("Sheath.L", mSword1); ent->attachObjectToBone("Sheath.R", mSword2); getTargetNode()->setFixedYawAxis(true); }
ccColor4F CC3ActionTintDiffuseTo::getTargetColor() { return getTargetNode()->getDiffuseColor(); }
void CC3ActionTintDiffuseTo::setTargetColor( const ccColor4F& aColor ) { getTargetNode()->setDiffuseColor( aColor ); }
void CC3ActionRotateTo::setTargetVector( const CC3Vector& aRotation ) { getTargetNode()->setRotation( aRotation ); }
void CC3ActionTintAmbientTo::setTargetColor( const ccColor4F& aColor ) { getTargetNode()->setAmbientColor( aColor ); }
void CC3ActionAnimate::update( float t ) { getTargetNode()->establishAnimationFrameAt( m_isReversed ? (1.0f - t) : t, m_trackID ); }
void CC3ActionAnimationCrossFade::update( float t ) { CC3Node* node = getTargetNode(); node->setAnimationBlendingWeight( ((1.f - t) * m_startWeight), m_fromTrackID ); node->setAnimationBlendingWeight( (t * m_endWeight), m_toTrackID ); }
void CC3ActionMoveTo::setTargetVector( const CC3Vector& aLocation ) { getTargetNode()->setLocation( aLocation ); }
ccColor4F CC3ActionTintEmissionTo::getTargetColor() { return getTargetNode()->getEmissionColor(); }
CC3Vector CC3ActionRotateToLookTowards::getTargetVector() { return getTargetNode()->getForwardDirection(); }
void CC3ActionRotateToLookTowards::setTargetVector( const CC3Vector& aDirection ) { getTargetNode()->setForwardDirection( aDirection ); }
void CC3ActionRotateToAngle::update( float t ) { getTargetNode()->setRotationAngle( m_startAngle + (m_diffAngle * t) ); }
void CC3ActionScaleTo::setTargetVector( const CC3Vector& aScale ) { getTargetNode()->setScale( aScale ); }
CC3Vector CC3ActionScaleTo::getTargetVector() { return getTargetNode()->getScale(); }
ccColor4F CC3ActionTintSpecularTo::getTargetColor() { return getTargetNode()->getSpecularColor(); }
CC3Vector CC3ActionMoveForwardBy::getTargetDirection() { return getTargetNode()->getForwardDirection(); }
void CC3ActionTintSpecularTo::setTargetColor( const ccColor4F& aColor ) { getTargetNode()->setSpecularColor( aColor ); }
CC3Vector CC3ActionMoveRightBy::getTargetDirection() { return getTargetNode()->getRightDirection(); }
void CC3ActionTintEmissionTo::setTargetColor( const ccColor4F& aColor ) { getTargetNode()->setEmissionColor( aColor ); }
CC3Vector CC3ActionMoveTo::getTargetVector() { return getTargetNode()->getLocation(); }
void CC3ActionAnimationBlendingFadeTrackTo::update( float t ) { getTargetNode()->setAnimationBlendingWeight( m_startWeight + (t * (m_endWeight - m_startWeight)), m_trackID ); }
ccColor4F CC3ActionTintAmbientTo::getTargetColor() { return getTargetNode()->getAmbientColor(); }
CC3Vector CC3ActionMoveUpBy::getTargetDirection() { return getTargetNode()->getUpDirection(); }
CC3Vector CC3ActionRotateTo::getTargetVector() { return getTargetNode()->getRotation(); }