diff options
| author | Stefan Suhren <suhren.stefan@fh-swf.de> | 2015-12-14 16:50:02 +0100 |
|---|---|---|
| committer | Stefan Suhren <suhren.stefan@fh-swf.de> | 2015-12-14 17:07:19 +0100 |
| commit | 88f73581a5467cd00aaf7699cd43cfb6216bd1fc (patch) | |
| tree | 0ef292e4b5b5d7e4dcb1fe1e6f7167782b1eaa99 /src | |
| parent | e3c3430355e53dff419f78168cb99f98915d7f3d (diff) | |
| download | Multimedia-88f73581a5467cd00aaf7699cd43cfb6216bd1fc.tar.gz Multimedia-88f73581a5467cd00aaf7699cd43cfb6216bd1fc.zip | |
Add bottom hit detection
Diffstat (limited to 'src')
| -rw-r--r-- | src/gldisc.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/gldisc.cpp b/src/gldisc.cpp index a2c22b5..03a0c6b 100644 --- a/src/gldisc.cpp +++ b/src/gldisc.cpp @@ -82,12 +82,21 @@ void GLDisc::makeSurface(QVector<GLPoint> *pointContainer, bool GLDisc::isHit(QVector3D p1, QVector3D p2) { - if(!GLBody::isHit(p1, p2)) + if (!GLBody::isHit(p1, p2)) { return false; } + QVector3D lineVector = p2 - p1; + QVector3D vecBottom = p1 + lineVector * (-p1.z() / lineVector.z()); + + if (vecBottom.length() < m_circleRadius) + { + return true; + } + + return false; } QVector2D GLDisc::calculatePoint(double sideAngle) |
