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 Entity::Update() { if(m_MoveEntity != nullptr) { m_MovePosition = m_MoveEntity->GetPosition(); m_MoveStopDistance = GetSolidRadius() + m_MoveEntity->GetSolidRadius(); } if(m_TurnEntity != nullptr) { Ogre::Degree angle = GetDirectionToEntity(m_TurnEntity); angle = CalculateTurnAngle(m_TurnDirectionStart, angle); m_TurnDirectionEnd = angle; } }