diff options
author | megamage <none@none> | 2009-01-29 19:35:49 -0600 |
---|---|---|
committer | megamage <none@none> | 2009-01-29 19:35:49 -0600 |
commit | b0bf621a139aaa6e620098fc7a4411a800fda43d (patch) | |
tree | a80cfed503a562c4e436814dc056e8b22386efef /src/game/Object.cpp | |
parent | 25ab1fa4adfe1e9be1f8bfb6701f6a0d48887770 (diff) | |
parent | adee7cab17e191ab9d735c326cd611f0380736d6 (diff) |
*Merge.
--HG--
branch : trunk
Diffstat (limited to 'src/game/Object.cpp')
-rw-r--r-- | src/game/Object.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/game/Object.cpp b/src/game/Object.cpp index 5c46ba93a5a..caaadd1851f 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -1187,6 +1187,14 @@ float WorldObject::GetDistance(const float x, const float y, const float z) cons return ( dist > 0 ? dist : 0); } +float WorldObject::GetDistanceSq(const float &x, const float &y, const float &z) const +{ + float dx = GetPositionX() - x; + float dy = GetPositionY() - y; + float dz = GetPositionZ() - z; + return dx*dx + dy*dy + dz*dz; +} + float WorldObject::GetDistance2d(const WorldObject* obj) const { float dx = GetPositionX() - obj->GetPositionX(); |