| 3295 | //---------------------------------------------------------------------------- |
| 3296 | |
| 3297 | bool Player::checkDismountPosition(const MatrixF& oldMat, const MatrixF& mat) |
| 3298 | { |
| 3299 | AssertFatal(getContainer() != NULL, "Error, must have a container!"); |
| 3300 | AssertFatal(getObjectMount() != NULL, "Error, must be mounted!"); |
| 3301 | |
| 3302 | Point3F pos; |
| 3303 | Point3F oldPos; |
| 3304 | mat.getColumn(3, &pos); |
| 3305 | oldMat.getColumn(3, &oldPos); |
| 3306 | RayInfo info; |
| 3307 | disableCollision(); |
| 3308 | getObjectMount()->disableCollision(); |
| 3309 | if (getContainer()->castRay(oldPos, pos, sCollisionMoveMask, &info)) |
| 3310 | { |
| 3311 | enableCollision(); |
| 3312 | getObjectMount()->enableCollision(); |
| 3313 | return false; |
| 3314 | } |
| 3315 | |
| 3316 | Box3F wBox = mObjBox; |
| 3317 | wBox.minExtents += pos; |
| 3318 | wBox.maxExtents += pos; |
| 3319 | |
| 3320 | EarlyOutPolyList polyList; |
| 3321 | polyList.mNormal.set(0.0f, 0.0f, 0.0f); |
| 3322 | polyList.mPlaneList.clear(); |
| 3323 | polyList.mPlaneList.setSize(6); |
| 3324 | polyList.mPlaneList[0].set(wBox.minExtents,VectorF(-1.0f, 0.0f, 0.0f)); |
| 3325 | polyList.mPlaneList[1].set(wBox.maxExtents,VectorF(0.0f, 1.0f, 0.0f)); |
| 3326 | polyList.mPlaneList[2].set(wBox.maxExtents,VectorF(1.0f, 0.0f, 0.0f)); |
| 3327 | polyList.mPlaneList[3].set(wBox.minExtents,VectorF(0.0f, -1.0f, 0.0f)); |
| 3328 | polyList.mPlaneList[4].set(wBox.minExtents,VectorF(0.0f, 0.0f, -1.0f)); |
| 3329 | polyList.mPlaneList[5].set(wBox.maxExtents,VectorF(0.0f, 0.0f, 1.0f)); |
| 3330 | |
| 3331 | if (getContainer()->buildPolyList(PLC_Collision, wBox, sCollisionMoveMask, &polyList)) |
| 3332 | { |
| 3333 | enableCollision(); |
| 3334 | getObjectMount()->enableCollision(); |
| 3335 | return false; |
| 3336 | } |
| 3337 | |
| 3338 | enableCollision(); |
| 3339 | getObjectMount()->enableCollision(); |
| 3340 | return true; |
| 3341 | } |
| 3342 | |
| 3343 | |
| 3344 | //---------------------------------------------------------------------------- |
no test coverage detected