Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErwin Coumans <blender@erwincoumans.com>2006-05-23 01:03:43 +0400
committerErwin Coumans <blender@erwincoumans.com>2006-05-23 01:03:43 +0400
commitab71e2a9b55e0982d1134792d10af55464c7ac9e (patch)
tree4a53791a67d3234360107a33c5365d4de4844bb7 /source/gameengine/Ketsji/KX_NearSensor.cpp
parent677cf7f1333c634a52227a15d6dcb3351b39febc (diff)
-added basic support for GameActuator 'load game', relative paths were broken, just load file into memory and load blend from memory.
-near sensor support - python binding for PhysicsConstraints.setNumTimeSubSteps (dividing the physics timestep to tradeoff quality for performance)
Diffstat (limited to 'source/gameengine/Ketsji/KX_NearSensor.cpp')
-rw-r--r--source/gameengine/Ketsji/KX_NearSensor.cpp31
1 files changed, 28 insertions, 3 deletions
diff --git a/source/gameengine/Ketsji/KX_NearSensor.cpp b/source/gameengine/Ketsji/KX_NearSensor.cpp
index 5c6f038e23d..fac2302b85e 100644
--- a/source/gameengine/Ketsji/KX_NearSensor.cpp
+++ b/source/gameengine/Ketsji/KX_NearSensor.cpp
@@ -80,7 +80,10 @@ KX_NearSensor::KX_NearSensor(SCA_EventManager* eventmgr,
void KX_NearSensor::RegisterSumo(KX_TouchEventManager *touchman)
{
- touchman->GetPhysicsEnvironment()->addSensor(m_physCtrl);
+ if (m_physCtrl)
+ {
+ touchman->GetPhysicsEnvironment()->addSensor(m_physCtrl);
+ }
}
CValue* KX_NearSensor::GetReplica()
@@ -96,7 +99,18 @@ CValue* KX_NearSensor::GetReplica()
replica->m_client_info = new KX_ClientObjectInfo(m_client_info->m_gameobject, KX_ClientObjectInfo::NEAR);
- replica->m_physCtrl = replica->m_physCtrl->GetReplica();
+ if (replica->m_physCtrl)
+ {
+ replica->m_physCtrl = replica->m_physCtrl->GetReplica();
+ if (replica->m_physCtrl)
+ {
+ //static_cast<KX_TouchEventManager*>(m_eventmgr)->GetPhysicsEnvironment()->addSensor(replica->m_physCtrl);
+ replica->m_physCtrl->SetMargin(m_Margin);
+ replica->m_physCtrl->setNewClientInfo(replica->m_client_info);
+ }
+
+ }
+ //static_cast<KX_TouchEventManager*>(m_eventmgr)->RegisterSensor(this);
//todo: make sure replication works fine
//>m_sumoObj = new SM_Object(DT_NewSphere(0.0),NULL,NULL,NULL);
//replica->m_sumoObj->setMargin(m_Margin);
@@ -111,11 +125,21 @@ CValue* KX_NearSensor::GetReplica()
void KX_NearSensor::ReParent(SCA_IObject* parent)
{
+
SCA_ISensor::ReParent(parent);
m_client_info->m_gameobject = static_cast<KX_GameObject*>(parent);
m_client_info->m_sensors.push_back(this);
+
+/* KX_ClientObjectInfo *client_info = gameobj->getClientInfo();
+ client_info->m_gameobject = gameobj;
+ client_info->m_auxilary_info = NULL;
+
+ client_info->m_sensors.push_back(this);
+ SCA_ISensor::ReParent(parent);
+*/
+
SynchronizeTransform();
}
@@ -127,10 +151,11 @@ KX_NearSensor::~KX_NearSensor()
// for touchsensor, it's the parent
if (m_physCtrl)
{
- static_cast<KX_TouchEventManager*>(m_eventmgr)->GetPhysicsEnvironment()->removeSensor(m_physCtrl);
+ //static_cast<KX_TouchEventManager*>(m_eventmgr)->GetPhysicsEnvironment()->removeSensor(m_physCtrl);
delete m_physCtrl;
m_physCtrl = NULL;
}
+
if (m_client_info)
delete m_client_info;