| 210 | } |
| 211 | |
| 212 | void ControlledActor::tryStandup() |
| 213 | { |
| 214 | // overlap with upper part |
| 215 | if(mType==PxControllerShapeType::eBOX) |
| 216 | { |
| 217 | } |
| 218 | else if(mType==PxControllerShapeType::eCAPSULE) |
| 219 | { |
| 220 | PxScene* scene = mController->getScene(); |
| 221 | PxSceneReadLock scopedLock(*scene); |
| 222 | |
| 223 | PxCapsuleController* capsuleCtrl = static_cast<PxCapsuleController*>(mController); |
| 224 | |
| 225 | PxReal r = capsuleCtrl->getRadius(); |
| 226 | PxReal dh = mStandingSize - mCrouchingSize-2*r; |
| 227 | PxCapsuleGeometry geom(r, dh*.5f); |
| 228 | |
| 229 | PxExtendedVec3 position = mController->getPosition(); |
| 230 | PxVec3 pos((float)position.x,(float)position.y+mStandingSize*.5f+r,(float)position.z); |
| 231 | PxQuat orientation(PxHalfPi, PxVec3(0.0f, 0.0f, 1.0f)); |
| 232 | |
| 233 | PxOverlapBuffer hit; |
| 234 | if(scene->overlap(geom, PxTransform(pos,orientation), hit, PxQueryFilterData(PxQueryFlag::eANY_HIT|PxQueryFlag::eSTATIC|PxQueryFlag::eDYNAMIC))) |
| 235 | return; |
| 236 | } |
| 237 | |
| 238 | // if no hit, we can stand up |
| 239 | resizeStanding(); |
| 240 | |
| 241 | mDoStandup = false; |
| 242 | mIsCrouching = false; |
| 243 | } |
| 244 | |
| 245 | void ControlledActor::resizeController(PxReal height) |
| 246 | { |
nothing calls this directly
no test coverage detected