Browse Source

Merge pull request #194 from Hoikas/physx

Redo some PhysX Hacks
Branan Purvine-Riley 13 years ago
parent
commit
db2f4a0bf1
  1. 16
      Sources/Plasma/FeatureLib/pfCamera/plVirtualCamNeu.cpp
  2. 6
      Sources/Plasma/PubUtilLib/plPhysX/plPXPhysicalControllerCore.cpp
  3. 21
      Sources/Plasma/PubUtilLib/plPhysical/plCollisionDetector.cpp
  4. 8
      Sources/Plasma/PubUtilLib/plPhysical/plCollisionDetector.h

16
Sources/Plasma/FeatureLib/pfCamera/plVirtualCamNeu.cpp

@ -1507,8 +1507,13 @@ void plVirtualCam1::AddCameraToStack(plCameraModifier1* pCam)
void plVirtualCam1::PushCamera(plCameraModifier1* pCam, hsBool bDefault) void plVirtualCam1::PushCamera(plCameraModifier1* pCam, hsBool bDefault)
{ {
// pushing the same camera, folks? // pushing the same camera, folks?
// -- disallowed 2/13/2012 --
if (pCam == GetCurrentStackCamera()) if (pCam == GetCurrentStackCamera())
{
AddCameraToStack(pCam);
return;
}
// make sure that we don't keep adding the default camera if we're already in it
if (bDefault && pCam == GetCurrentStackCamera())
return; return;
// look up whatever transition we might have specified // look up whatever transition we might have specified
@ -1680,13 +1685,14 @@ void plVirtualCam1::PopCamera(plCameraModifier1* pCam)
if (fCameraStack.size() <= 1) if (fCameraStack.size() <= 1)
return; return;
// Crazy Special Casing Turd: [based on some Cyan crap]
// is it the current camera AND the same camera we would otherwise switch to? // is it the current camera AND the same camera we would otherwise switch to?
if (pCam==GetCurrentStackCamera() && pCam == fCameraStack[fCameraStack.size() - 2]) // if so, pop off the dupe if we're going to the age default... otherwise, go crazy.
if (fCameraStack.size() > 2 && pCam == GetCurrentStackCamera())
{ {
// pop but don't transition to a new camera int theDupe = fCameraStack.size() - 1;
// or do anything else: if (pCam == fCameraStack[theDupe] && theDupe == 2)
fCameraStack.pop_back(); fCameraStack.pop_back();
return;
} }
// are we mouse-looking? // are we mouse-looking?

6
Sources/Plasma/PubUtilLib/plPhysX/plPXPhysicalControllerCore.cpp

@ -483,7 +483,7 @@ NxScene* scene = plSimulationMgr::GetInstance()->GetScene(fWorldKey);
NxCapsuleControllerDesc desc; NxCapsuleControllerDesc desc;
desc.position.x = 0; desc.position.x = 0;
desc.position.y = 0; desc.position.y = 0;
desc.position.z = 0; desc.position.z = -10000; // No one should be building down there... (-2000 is kickable limit)
desc.upDirection = NX_Z; desc.upDirection = NX_Z;
desc.slopeLimit = kSLOPELIMIT; desc.slopeLimit = kSLOPELIMIT;
desc.skinWidth = kPhysxSkinWidth; desc.skinWidth = kPhysxSkinWidth;
@ -531,7 +531,9 @@ NxScene* scene = plSimulationMgr::GetInstance()->GetScene(fWorldKey);
fKinematicActor->raiseActorFlag(NX_AF_DISABLE_COLLISION); fKinematicActor->raiseActorFlag(NX_AF_DISABLE_COLLISION);
#endif #endif
// set the matrix to be the same as the controller's actor... that should orient it to be the same // set the matrix to be the same as the controller's actor... that should orient it to be the same
fKinematicActor->moveGlobalPose(actor->getGlobalPose()); // PhysX HACK TURD: Sometimes, using the ***wrong*** function is desirable...
// Changing this to moveGlobalPose will cause camera regions to fire before linking in.
fKinematicActor->setGlobalPose(actor->getGlobalPose());
// the proxy for the debug display // the proxy for the debug display
//hsAssert(!fProxyGen, "Already have proxy gen, double read?"); //hsAssert(!fProxyGen, "Already have proxy gen, double read?");

21
Sources/Plasma/PubUtilLib/plPhysical/plCollisionDetector.cpp

@ -73,9 +73,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
plArmatureMod* plCollisionDetector::IGetAvatarModifier(plKey key) plArmatureMod* plCollisionDetector::IGetAvatarModifier(plKey key)
{ {
if (!key)
return nil;
plSceneObject* avObj = plSceneObject::ConvertNoRef(key->ObjectIsLoaded()); plSceneObject* avObj = plSceneObject::ConvertNoRef(key->ObjectIsLoaded());
if (avObj) if (avObj)
{ {
@ -245,6 +242,8 @@ plCameraRegionDetector::~plCameraRegionDetector()
void plCameraRegionDetector::ITrigger(plKey hitter, bool entering, bool immediate) void plCameraRegionDetector::ITrigger(plKey hitter, bool entering, bool immediate)
{ {
if (fSavingSendMsg)
DetectorLogRed("%s: Stale messages on ITrigger. This should never happen!", GetKeyName().c_str());
if (fIsInside && entering) if (fIsInside && entering)
DetectorLogRed("%s: Duplicate enter! Did we miss an exit?", GetKeyName().c_str()); DetectorLogRed("%s: Duplicate enter! Did we miss an exit?", GetKeyName().c_str());
else if (!fIsInside && !entering) else if (!fIsInside && !entering)
@ -385,18 +384,11 @@ hsBool plObjectInVolumeDetector::MsgReceive(plMessage* msg)
plCollideMsg* pCollMsg = plCollideMsg::ConvertNoRef(msg); plCollideMsg* pCollMsg = plCollideMsg::ConvertNoRef(msg);
if (pCollMsg) if (pCollMsg)
{ {
fLastHitter = pCollMsg->fOtherKey;
// If the avatar is disabled (flying around), don't trigger // If the avatar is disabled (flying around), don't trigger
if (IIsDisabledAvatar(fLastHitter)) if (IIsDisabledAvatar(pCollMsg->fOtherKey))
return false; return false;
ITrigger(fLastHitter, (pCollMsg->fEntering != 0)); ITrigger(pCollMsg->fOtherKey, (pCollMsg->fEntering != 0));
// If we never eval before the exit...
if (fWaitingForEval)
plgDispatch::Dispatch()->UnRegisterForExactType(plEvalMsg::Index(), GetKey());
else
plgDispatch::Dispatch()->RegisterForExactType(plEvalMsg::Index(), GetKey()); plgDispatch::Dispatch()->RegisterForExactType(plEvalMsg::Index(), GetKey());
fWaitingForEval = !fWaitingForEval;
return true; return true;
} }
@ -404,13 +396,8 @@ hsBool plObjectInVolumeDetector::MsgReceive(plMessage* msg)
if (pEvalMsg) if (pEvalMsg)
{ {
fNumEvals++; fNumEvals++;
// Don't dispatch if we're not in the age
if (plArmatureMod* av = IGetAvatarModifier(fLastHitter))
if (av->IsMidLink())
return true;
ISendSavedTriggerMsgs(); ISendSavedTriggerMsgs();
plgDispatch::Dispatch()->UnRegisterForExactType(plEvalMsg::Index(), GetKey()); plgDispatch::Dispatch()->UnRegisterForExactType(plEvalMsg::Index(), GetKey());
fWaitingForEval = false;
} }
plPlayerPageMsg* pageMsg = plPlayerPageMsg::ConvertNoRef(msg); plPlayerPageMsg* pageMsg = plPlayerPageMsg::ConvertNoRef(msg);

8
Sources/Plasma/PubUtilLib/plPhysical/plCollisionDetector.h

@ -99,19 +99,15 @@ protected:
uint32_t fNumEvals; uint32_t fNumEvals;
uint32_t fLastEnterEval; uint32_t fLastEnterEval;
uint32_t fLastExitEval; uint32_t fLastExitEval;
bool fWaitingForEval;
plKey fLastHitter;
public: public:
plObjectInVolumeDetector() plObjectInVolumeDetector()
: plCollisionDetector(), fSavedActivatorMsg(nil), fNumEvals(0), fLastEnterEval(0), : plCollisionDetector(), fSavedActivatorMsg(nil), fNumEvals(0), fLastEnterEval(0), fLastExitEval(0)
fWaitingForEval(false), fLastHitter(nil)
{ } { }
plObjectInVolumeDetector(int8_t type) plObjectInVolumeDetector(int8_t type)
: plCollisionDetector(type), fSavedActivatorMsg(nil), fNumEvals(0), fLastEnterEval(0), : plCollisionDetector(type), fSavedActivatorMsg(nil), fNumEvals(0), fLastEnterEval(0), fLastExitEval(0)
fWaitingForEval(false), fLastHitter(nil)
{ } { }
virtual ~plObjectInVolumeDetector() { } virtual ~plObjectInVolumeDetector() { }

Loading…
Cancel
Save