| 3420 | } |
| 3421 | |
| 3422 | bool Player::canStand() |
| 3423 | { |
| 3424 | if ( mState != MoveState || |
| 3425 | mDamageState != Enabled || |
| 3426 | isMounted() || |
| 3427 | mSwimming ) |
| 3428 | return false; |
| 3429 | |
| 3430 | // We are already in this pose, so don't test it again... |
| 3431 | if ( mPose == StandPose ) |
| 3432 | return true; |
| 3433 | |
| 3434 | // Do standard Torque physics test here! |
| 3435 | if ( !mPhysicsRep ) |
| 3436 | { |
| 3437 | F32 radius; |
| 3438 | |
| 3439 | if (mPose == CrouchPose) |
| 3440 | radius = mDataBlock->crouchBoxSize.z; |
| 3441 | else if (mPose == PronePose) |
| 3442 | radius = mDataBlock->proneBoxSize.z; |
| 3443 | else |
| 3444 | return true; |
| 3445 | |
| 3446 | // use our X and Y dimentions on our boxsize as the radii for our search, and the difference between a standing position |
| 3447 | // and the position we currently are in. |
| 3448 | Point3F extent( mDataBlock->boxSize.x / 2, mDataBlock->boxSize.y / 2, mDataBlock->boxSize.z - radius ); |
| 3449 | |
| 3450 | Point3F position = getPosition(); |
| 3451 | position.z += radius; |
| 3452 | |
| 3453 | // Use these radii to create a box that represents the difference between a standing position and the position |
| 3454 | // we want to move into. |
| 3455 | Box3F B(position - extent, position + extent, true); |
| 3456 | |
| 3457 | EarlyOutPolyList polyList; |
| 3458 | polyList.mPlaneList.clear(); |
| 3459 | polyList.mNormal.set(0,0,0); |
| 3460 | polyList.mPlaneList.setSize(6); |
| 3461 | polyList.mPlaneList[0].set(B.minExtents, VectorF(-1,0,0)); |
| 3462 | polyList.mPlaneList[1].set(B.maxExtents, VectorF(0,1,0)); |
| 3463 | polyList.mPlaneList[2].set(B.maxExtents, VectorF(1,0,0)); |
| 3464 | polyList.mPlaneList[3].set(B.minExtents, VectorF(0,-1,0)); |
| 3465 | polyList.mPlaneList[4].set(B.minExtents, VectorF(0,0,-1)); |
| 3466 | polyList.mPlaneList[5].set(B.maxExtents, VectorF(0,0,1)); |
| 3467 | |
| 3468 | // If an object exists in this space, we must stay crouched/prone. Otherwise we are free to stand. |
| 3469 | return !getContainer()->buildPolyList(PLC_Collision, B, StaticShapeObjectType, &polyList); |
| 3470 | } |
| 3471 | |
| 3472 | return mPhysicsRep->testSpacials( getPosition(), mDataBlock->boxSize ); |
| 3473 | } |
| 3474 | |
| 3475 | bool Player::canProne() |
| 3476 | { |
nothing calls this directly
no test coverage detected