|
|
@ -43,6 +43,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com |
|
|
|
|
|
|
|
|
|
|
|
#include <NxPhysics.h> |
|
|
|
#include <NxPhysics.h> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "plgDispatch.h" |
|
|
|
#include "hsTimer.h" |
|
|
|
#include "hsTimer.h" |
|
|
|
#include "plProfile.h" |
|
|
|
#include "plProfile.h" |
|
|
|
#include "plPXPhysical.h" |
|
|
|
#include "plPXPhysical.h" |
|
|
@ -206,13 +207,13 @@ class SensorReport : public NxUserTriggerReport |
|
|
|
|
|
|
|
|
|
|
|
void SendCollisionMsg(plKey receiver, plKey hitter, hsBool entering) |
|
|
|
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; |
|
|
|
plCollideMsg* msg = TRACKED_NEW plCollideMsg; |
|
|
|
msg->fOtherKey = hitter; |
|
|
|
msg->fOtherKey = hitter; |
|
|
|
msg->fEntering = entering; |
|
|
|
msg->fEntering = entering; |
|
|
|
msg->AddReceiver(receiver); |
|
|
|
msg->AddReceiver(receiver); |
|
|
|
// msg->Send();\
|
|
|
|
plgDispatch::Dispatch()->MsgQueue(msg); // Sends the msg on the next client update
|
|
|
|
//placing message in a list to be fired off after sim step
|
|
|
|
|
|
|
|
plSimulationMgr::GetInstance()->AddCollisionMsg(msg); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} gSensorReport; |
|
|
|
} gSensorReport; |
|
|
@ -536,6 +537,8 @@ void plSimulationMgr::ReleaseScene(plKey world) |
|
|
|
|
|
|
|
|
|
|
|
void plSimulationMgr::ISendCollisionMsg(plKey receiver, plKey hitter, hsBool entering) |
|
|
|
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; |
|
|
|
plCollideMsg* msg = TRACKED_NEW plCollideMsg; |
|
|
|
msg->fOtherKey = hitter; |
|
|
|
msg->fOtherKey = hitter; |
|
|
|
msg->fEntering = entering; |
|
|
|
msg->fEntering = entering; |
|
|
@ -543,34 +546,6 @@ void plSimulationMgr::ISendCollisionMsg(plKey receiver, plKey hitter, hsBool ent |
|
|
|
msg->Send(); |
|
|
|
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) |
|
|
|
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
|
|
|
|
// 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); |
|
|
|
plPXPhysicalControllerCore::UpdatePostSimStep(delSecs); |
|
|
|
|
|
|
|
|
|
|
|
//sending off and clearing the Collision Messages generated by scene->simulate
|
|
|
|
|
|
|
|
IDispatchCollisionMessages(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
plProfile_EndTiming(Step); |
|
|
|
plProfile_EndTiming(Step); |
|
|
|
#ifndef PLASMA_EXTERNAL_RELEASE |
|
|
|
#ifndef PLASMA_EXTERNAL_RELEASE |
|
|
|