mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-14 10:37:41 -04:00
@ -151,6 +151,7 @@ void pfMarkerInfo::Show(bool show)
|
||||
plEnableMsg* msg = TRACKED_NEW plEnableMsg;
|
||||
msg->SetBCastFlag(plMessage::kPropagateToChildren);
|
||||
msg->SetCmd(plEnableMsg::kDrawable);
|
||||
msg->SetCmd(plEnableMsg::kPhysical);
|
||||
msg->SetCmd(show ? plEnableMsg::kEnable : plEnableMsg::kDisable);
|
||||
msg->SetSender(pfMarkerMgr::Instance()->GetKey());
|
||||
msg->Send(fKey);
|
||||
|
@ -1302,7 +1302,7 @@ hsBool plArmatureMod::MsgReceive(plMessage* msg)
|
||||
if(spawnSO)
|
||||
{
|
||||
hsMatrix44 l2w = spawnSO->GetLocalToWorld();
|
||||
plWarpMsg *warpM = TRACKED_NEW plWarpMsg(nil, GetTarget(0)->GetKey(), 0, l2w);
|
||||
plWarpMsg *warpM = TRACKED_NEW plWarpMsg(nil, GetTarget(0)->GetKey(), plWarpMsg::kFlushTransform, l2w);
|
||||
warpM->Send();
|
||||
fWaitFlags &= ~kNeedSpawn;
|
||||
}
|
||||
|
@ -48,6 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
void DetectorLog(const char* format, ...) {}
|
||||
void DetectorLogSpecial(const char* format, ...) {}
|
||||
void DetectorLogRed(const char* format, ...) {}
|
||||
void DetectorLogYellow(const char* format, ...) {}
|
||||
|
||||
#else
|
||||
|
||||
@ -90,5 +91,12 @@ void DetectorLogRed(const char* format, ...)
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void DetectorLogYellow(const char* format, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
gLog->AddLineV(plStatusLog::kYellow, format, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
#endif // PLASMA_EXTERNAL_RELEASE
|
||||
|
@ -45,6 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
void DetectorLog(const char* format, ...);
|
||||
void DetectorLogSpecial(const char* format, ...);
|
||||
void DetectorLogRed(const char* format, ...);
|
||||
void DetectorLogYellow(const char* format, ...);
|
||||
void DetectorDoLogfile();
|
||||
|
||||
#endif // plDetectorLog_h_inc
|
@ -827,6 +827,7 @@ void plPXPhysical::ApplyHitForce()
|
||||
void plPXPhysical::ISetTransformGlobal(const hsMatrix44& l2w)
|
||||
{
|
||||
hsAssert(fActor->isDynamic(), "Shouldn't move a static actor");
|
||||
fActor->wakeUp();
|
||||
|
||||
NxMat34 mat;
|
||||
|
||||
@ -1000,15 +1001,7 @@ plKey plPXPhysical::GetSceneNode() const
|
||||
|
||||
void plPXPhysical::SetSceneNode(plKey newNode)
|
||||
{
|
||||
#ifdef HS_DEBUGGING
|
||||
plKey oldNode = GetSceneNode();
|
||||
char msg[1024];
|
||||
if (newNode)
|
||||
sprintf(msg,"Physical object %s cannot change scenes. Already in %s, trying to switch to %s.",fObjectKey->GetName(),oldNode->GetName(),newNode->GetName());
|
||||
else
|
||||
sprintf(msg,"Physical object %s cannot change scenes. Already in %s, trying to switch to <nil key>.",fObjectKey->GetName(),oldNode->GetName());
|
||||
hsAssert(oldNode == newNode, msg);
|
||||
#endif // HS_DEBUGGING
|
||||
// Not Supported
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
@ -40,6 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
*==LICENSE==*/
|
||||
#include "plPXPhysicalControllerCore.h"
|
||||
#include "plgDispatch.h"
|
||||
#include "plSimulationMgr.h"
|
||||
#include "plPXPhysical.h"
|
||||
#include "plPXConvert.h"
|
||||
@ -372,13 +373,6 @@ void plPXPhysicalControllerCore::ISetGlobalLoc(const hsMatrix44& l2w)
|
||||
plPXPhysicalControllerCore::~plPXPhysicalControllerCore()
|
||||
{
|
||||
IDeleteController();
|
||||
//need to make sure my queued messages are released
|
||||
for(int j=0;j<fQueuedCollideMsgs.GetCount();j++)
|
||||
{
|
||||
delete fQueuedCollideMsgs[j];
|
||||
fQueuedCollideMsgs[j]=nil;
|
||||
}
|
||||
fQueuedCollideMsgs.SetCount(0);
|
||||
for (int i = 0; i < gControllers.size(); i++)
|
||||
{
|
||||
if (gControllers[i] == this)
|
||||
@ -401,7 +395,7 @@ void plPXPhysicalControllerCore::IMatchKinematicToController()
|
||||
kinPos.z = (NxReal)cPos.z;
|
||||
if (plSimulationMgr::fExtraProfile)
|
||||
SimLog("Match setting kinematic from %f,%f,%f to %f,%f,%f",prevKinPos.x,prevKinPos.y,prevKinPos.z,kinPos.x,kinPos.y,kinPos.z );
|
||||
fKinematicActor->setGlobalPosition(kinPos);
|
||||
fKinematicActor->moveGlobalPosition(kinPos);
|
||||
}
|
||||
}
|
||||
void plPXPhysicalControllerCore::UpdateControllerAndPhysicalRep()
|
||||
@ -412,7 +406,7 @@ void plPXPhysicalControllerCore::UpdateControllerAndPhysicalRep()
|
||||
{//this means we are moving the controller and then synchnig the kin
|
||||
NxExtendedVec3 ControllerPos= fController->getPosition();
|
||||
NxVec3 NewKinPos((NxReal)ControllerPos.x, (NxReal)ControllerPos.y, (NxReal)ControllerPos.z);
|
||||
if (fEnabled || fKinematic)
|
||||
if (fEnabled && fKinematicActor->readBodyFlag(NX_BF_KINEMATIC))
|
||||
{
|
||||
if (plSimulationMgr::fExtraProfile)
|
||||
SimLog("Moving kinematic to %f,%f,%f",NewKinPos.x, NewKinPos.y, NewKinPos.z );
|
||||
@ -420,7 +414,7 @@ void plPXPhysicalControllerCore::UpdateControllerAndPhysicalRep()
|
||||
fKinematicActor->moveGlobalPosition(NewKinPos);
|
||||
|
||||
}
|
||||
else
|
||||
else if (fEnabled)
|
||||
{
|
||||
if (plSimulationMgr::fExtraProfile)
|
||||
SimLog("Setting kinematic to %f,%f,%f", NewKinPos.x, NewKinPos.y, NewKinPos.z );
|
||||
@ -452,14 +446,14 @@ void plPXPhysicalControllerCore::MoveKinematicToController(hsPoint3& pos)
|
||||
newPos.x = (NxReal)pos.fX;
|
||||
newPos.y = (NxReal)pos.fY;
|
||||
newPos.z = (NxReal)pos.fZ+kPhysZOffset;
|
||||
if ((fEnabled || fKinematic) && fBehavingLikeAnimatedPhys)
|
||||
if (fEnabled && fKinematicActor->readBodyFlag(NX_BF_KINEMATIC))
|
||||
{
|
||||
if (plSimulationMgr::fExtraProfile)
|
||||
SimLog("Moving kinematic from %f,%f,%f to %f,%f,%f",pos.fX,pos.fY,pos.fZ+kPhysZOffset,kinPos.x,kinPos.y,kinPos.z );
|
||||
// use the position
|
||||
fKinematicActor->moveGlobalPosition(newPos);
|
||||
}
|
||||
else
|
||||
else if (fEnabled)
|
||||
{
|
||||
if (plSimulationMgr::fExtraProfile)
|
||||
SimLog("Setting kinematic from %f,%f,%f to %f,%f,%f",pos.fX,pos.fY,pos.fZ+kPhysZOffset,kinPos.x,kinPos.y,kinPos.z );
|
||||
@ -494,9 +488,9 @@ void plPXPhysicalControllerCore::ISetKinematicLoc(const hsMatrix44& l2w)
|
||||
// add z offset
|
||||
kPos.fZ += kPhysZOffset;
|
||||
// Update the physical position of kinematic
|
||||
if (fEnabled|| fKinematic)
|
||||
if (fEnabled && fKinematicActor->readBodyFlag(NX_BF_KINEMATIC))
|
||||
fKinematicActor->moveGlobalPosition(plPXConvert::Point(kPos));
|
||||
else
|
||||
else if (fEnabled)
|
||||
fKinematicActor->setGlobalPosition(plPXConvert::Point(kPos));
|
||||
}
|
||||
void plPXPhysicalControllerCore::IGetPositionSim(hsPoint3& pos) const
|
||||
@ -568,7 +562,7 @@ NxScene* scene = plSimulationMgr::GetInstance()->GetScene(fWorldKey);
|
||||
fKinematicActor->raiseActorFlag(NX_AF_DISABLE_COLLISION);
|
||||
#endif
|
||||
// set the matrix to be the same as the controller's actor... that should orient it to be the same
|
||||
fKinematicActor->setGlobalPose(actor->getGlobalPose());
|
||||
fKinematicActor->moveGlobalPose(actor->getGlobalPose());
|
||||
|
||||
// the proxy for the debug display
|
||||
//hsAssert(!fProxyGen, "Already have proxy gen, double read?");
|
||||
@ -706,26 +700,19 @@ void plPXPhysicalControllerCore::IInformDetectors(bool entering,bool deferUntilN
|
||||
msg->AddReceiver(physical->GetObjectKey());
|
||||
if(!deferUntilNextSim)
|
||||
{
|
||||
#ifndef PLASMA_EXTERNAL_RELEASE
|
||||
DetectorLog("Sending an %s msg to %s" , entering? "entering":"exit", physical->GetObjectKey()->GetName());
|
||||
#endif
|
||||
msg->Send();
|
||||
DetectorLog("Sending an %s msg to %s" , entering? "entering":"exit", physical->GetObjectKey()->GetName());
|
||||
msg->Send();
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifndef PLASMA_EXTERNAL_RELEASE
|
||||
DetectorLog("Queuing an %s msg to %s, which will be sent after the next simstep" , entering? "entering":"exit", physical->GetObjectKey()->GetName());
|
||||
#endif
|
||||
//these will be fired in update prestep on the next lap
|
||||
fQueuedCollideMsgs.Append(msg);
|
||||
DetectorLog("Queuing an %s msg to %s, which will be sent after the client update" , entering? "entering":"exit", physical->GetObjectKey()->GetName());
|
||||
plgDispatch::Dispatch()->MsgQueue(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifndef PLASMA_EXTERNAL_RELEASE
|
||||
DetectorLog("Done informing from plPXPhysicalControllerCore::IInformDetectors");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
void plPXPhysicalControllerCore::Move(hsVector3 displacement, unsigned int collideWith, unsigned int &collisionResults)
|
||||
@ -932,16 +919,6 @@ void plPXPhysicalControllerCore::UpdatePrestep(hsScalar delSecs)
|
||||
if(ac)
|
||||
{
|
||||
if(ac->fNeedsResize)ac->IHandleResize();
|
||||
int storedCollideMsgs=ac->fQueuedCollideMsgs.GetCount();
|
||||
if(storedCollideMsgs)
|
||||
{
|
||||
plSimulationMgr* simMgr=plSimulationMgr::GetInstance();
|
||||
for(int j=0; j<storedCollideMsgs;j++)
|
||||
{
|
||||
simMgr->AddCollisionMsg(ac->fQueuedCollideMsgs[j]);
|
||||
}
|
||||
ac->fQueuedCollideMsgs.SetCount(0);
|
||||
}
|
||||
ac->Apply(delSecs);
|
||||
}
|
||||
#ifndef PLASMA_EXTERNAL_RELEASE
|
||||
|
@ -151,7 +151,6 @@ protected:
|
||||
void IDrawDebugDisplay();
|
||||
#endif
|
||||
void IHandleResize();
|
||||
hsTArray<plCollideMsg*> fQueuedCollideMsgs;
|
||||
hsScalar fPreferedRadius;
|
||||
hsScalar fPreferedHeight;
|
||||
// The global position and rotation of the avatar last time we set it (so we
|
||||
|
@ -43,6 +43,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
#include <NxPhysics.h>
|
||||
|
||||
#include "plgDispatch.h"
|
||||
#include "hsTimer.h"
|
||||
#include "plProfile.h"
|
||||
#include "plPXPhysical.h"
|
||||
@ -206,13 +207,13 @@ class SensorReport : public NxUserTriggerReport
|
||||
|
||||
void SendCollisionMsg(plKey receiver, plKey hitter, hsBool entering)
|
||||
{
|
||||
DetectorLogYellow("Collision: %s was triggered by %s. Sending an %s msg", receiver->GetName(),
|
||||
hitter ? hitter->GetName() : "(nil)" , entering ? "'enter'" : "'exit'");
|
||||
plCollideMsg* msg = TRACKED_NEW plCollideMsg;
|
||||
msg->fOtherKey = hitter;
|
||||
msg->fEntering = entering;
|
||||
msg->AddReceiver(receiver);
|
||||
// msg->Send();\
|
||||
//placing message in a list to be fired off after sim step
|
||||
plSimulationMgr::GetInstance()->AddCollisionMsg(msg);
|
||||
plgDispatch::Dispatch()->MsgQueue(msg); // Sends the msg on the next client update
|
||||
}
|
||||
|
||||
} gSensorReport;
|
||||
@ -536,6 +537,8 @@ void plSimulationMgr::ReleaseScene(plKey world)
|
||||
|
||||
void plSimulationMgr::ISendCollisionMsg(plKey receiver, plKey hitter, hsBool entering)
|
||||
{
|
||||
DetectorLogYellow("Collision: %s is inside %s. Sending an %s msg", hitter ? hitter->GetName() : "(nil)",
|
||||
receiver->GetName(), entering ? "'enter'" : "'exit'");
|
||||
plCollideMsg* msg = TRACKED_NEW plCollideMsg;
|
||||
msg->fOtherKey = hitter;
|
||||
msg->fEntering = entering;
|
||||
@ -543,34 +546,6 @@ void plSimulationMgr::ISendCollisionMsg(plKey receiver, plKey hitter, hsBool ent
|
||||
msg->Send();
|
||||
}
|
||||
|
||||
void plSimulationMgr::AddCollisionMsg(plCollideMsg* msg)
|
||||
{
|
||||
fCollisionMessages.Append(msg);
|
||||
}
|
||||
void plSimulationMgr::IDispatchCollisionMessages()
|
||||
{
|
||||
if(fCollisionMessages.GetCount())
|
||||
{
|
||||
#ifndef PLASMA_EXTERNAL_RELEASE
|
||||
DetectorLog("--------------------------------------------------");
|
||||
DetectorLog("Dispatching collision messages from last sim step");
|
||||
#endif
|
||||
for(int i=0; i<fCollisionMessages.GetCount();i++)
|
||||
{
|
||||
#ifndef PLASMA_EXTERNAL_RELEASE
|
||||
DetectorLog("%s was hit by %s. Sending an %s message",fCollisionMessages[i]->GetReceiver(0)->GetName(),
|
||||
fCollisionMessages[i]->GetSender()?fCollisionMessages[i]->GetSender()->GetName():"An Avatar",
|
||||
fCollisionMessages[i]->fEntering? "enter" : "exit");
|
||||
#endif
|
||||
fCollisionMessages[i]->Send();
|
||||
}
|
||||
#ifndef PLASMA_EXTERNAL_RELEASE
|
||||
DetectorLog("--------------------------------------------------");
|
||||
#endif
|
||||
fCollisionMessages.SetCount(0);
|
||||
}
|
||||
}
|
||||
|
||||
void plSimulationMgr::UpdateDetectorsInScene(plKey world, plKey avatar, hsPoint3& pos, bool entering)
|
||||
{
|
||||
// search thru the actors in a scene looking for convex hull detectors and see if the avatar is inside it
|
||||
@ -679,9 +654,6 @@ void plSimulationMgr::Advance(float delSecs)
|
||||
}
|
||||
}
|
||||
plPXPhysicalControllerCore::UpdatePostSimStep(delSecs);
|
||||
|
||||
//sending off and clearing the Collision Messages generated by scene->simulate
|
||||
IDispatchCollisionMessages();
|
||||
|
||||
plProfile_EndTiming(Step);
|
||||
#ifndef PLASMA_EXTERNAL_RELEASE
|
||||
|
@ -139,12 +139,6 @@ protected:
|
||||
|
||||
plPhysicsSoundMgr* fSoundMgr;
|
||||
|
||||
//a list of collision messages generated by the simulation steps. Added to by AddCollisionMsg(plCollideMsg* msg)
|
||||
//cleared by IDispatchCollisionMessages when done
|
||||
hsTArray<plCollideMsg*> fCollisionMessages;
|
||||
|
||||
void IDispatchCollisionMessages();
|
||||
|
||||
// A mapping from a key to a PhysX scene. The key is either the
|
||||
// SimulationMgr key, for the main world, or a SceneObject key if it's a
|
||||
// subworld.
|
||||
|
Reference in New Issue
Block a user