void CCRenderer::update(const float delta) { if( updatingOrientation != 0 ) { for( int i=0; i<gEngine->scenes.length; ++i ) { gEngine->scenes.list[i]->beginOrientationUpdate(); } // Immediate update? if( updatingOrientation == 1 ) { orientation.current = orientation.target - CC_SMALLFLOAT; } updatingOrientation = 0; } if( CCToRotation( orientation.current, orientation.target, delta * 360.0f ) ) { for( int i=0; i<gEngine->cameras.length; ++i ) { CCCameraBase *camera = gEngine->cameras.list[i]; camera->flagUpdate(); } for( int i=0; i<gEngine->scenes.length; ++i ) { gEngine->scenes.list[i]->finishOrientationUpdate(); } } }
const float CharacterUpdaterPlayer::movePlayerRotation(const CCVector3 &target, const float delta) { const float angleTowardsTarget = CCAngleTowards( player->getPosition(), target ); CCToRotation( player->rotation.y, angleTowardsTarget, delta * 720.0f ); return angleTowardsTarget; }