void Entity::ScriptTurnToEntity( Entity* entity, const TurnDirection turn_direction, const float seconds ) { if( entity == NULL || entity == this ) { LOG_ERROR("[SCRIPT] Turn to entity: Invalid entity pointer (NUUL or this)."); return; } Ogre::Degree angle = GetDirectionToEntity( entity ); SetTurn( angle, entity, turn_direction, AT_SMOOTH, seconds ); LOG_TRIVIAL( "[SCRIPT] Entity \"" + m_Name + "\" turn to entity \"" + entity->GetName() + "."); }
void SetTurn90(unsigned int speed, char direction) { rightF = Adc_IR(IR_RI_F); rightF = Adc_IR(IR_RI_F); LED1=~LED1; rightR = Adc_IR(IR_RI_R); rightR = Adc_IR(IR_RI_R); LED1=~LED1; leftF = Adc_IR(IR_LE_F); leftF = Adc_IR(IR_LE_F); LED1=~LED1; leftR = Adc_IR(IR_LE_R); leftR = Adc_IR(IR_LE_R); LED1=~LED1; SetTurn(speed, direction, 72); if(direction == 0) { while(leftF > (leftR+0.1) || leftF < (leftR-0.1)) { SetSpeedDir(speed, 0, speed, 1); leftF = Adc_IR(IR_LE_F); leftF = Adc_IR(IR_LE_F); LED1=~LED1; leftR = Adc_IR(IR_LE_R); leftR = Adc_IR(IR_LE_R); LED1=~LED1; } SetSpeed(0,0); } else if (direction == 1) { while(rightF > (rightR+0.1) || rightF < (rightR-0.1)) { SetSpeedDir(speed, 0, speed, 1); rightF = Adc_IR(IR_RI_F); rightF = Adc_IR(IR_RI_F); LED1=~LED1; rightR = Adc_IR(IR_RI_R); rightR = Adc_IR(IR_RI_R); LED1=~LED1; } SetSpeed(0,0); } }
void Entity::ScriptTurnToDirection( const float direction, const TurnDirection turn_direction, const ActionType turn_type, const float seconds ) { SetTurn( Ogre::Degree( direction ), NULL, turn_direction, turn_type, seconds ); LOG_TRIVIAL("[SCRIPT] Entity \"" + m_Name + "\" turn to angle \"" + Ogre::StringConverter::toString( direction ) + "\"."); }