Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3049 for code/trunk/src/util


Ignore:
Timestamp:
May 25, 2009, 3:26:43 AM (16 years ago)
Author:
landauf
Message:
  • Added option to add a Controller to a ControllableEntity in the XML file
  • Added two new classes: WaypointController (follows waypoints) and WaypointPatrolController (follows waypoints and kills enemies within a given radius)
  • Radarpoints in TeamDeathmatch are now coloured
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/util/Math.cc

    r2171 r3049  
    129129
    130130        float projectionlength = projection.length();
    131         if (projectionlength == 0) return orxonox::Vector2(0, 0);
     131        if (projectionlength == 0)
     132        {
     133            if (myposition.dotProduct(otherposition) >= 0)
     134                return orxonox::Vector2(0, 0);
     135            else
     136                return orxonox::Vector2(0, 1);
     137        }
     138
    132139        float angle = acos(clamp<float>(myorthonormal.dotProduct(projection) / projectionlength, -1, 1));
    133140
     
    161168
    162169        float projectionlength = projection.length();
    163         if (projectionlength == 0) return orxonox::Vector2(0, 0);
     170        if (projectionlength == 0)
     171        {
     172            if (myposition.dotProduct(otherposition) >= 0)
     173                return orxonox::Vector2(0, 0);
     174            else
     175                return orxonox::Vector2(0, 1);
     176        }
    164177        float angle = acos(clamp<float>(myorthonormal.dotProduct(projection) / projectionlength, -1, 1));
    165178
Note: See TracChangeset for help on using the changeset viewer.