diff options
author | Erwin Coumans <blender@erwincoumans.com> | 2008-09-29 10:58:49 +0400 |
---|---|---|
committer | Erwin Coumans <blender@erwincoumans.com> | 2008-09-29 10:58:49 +0400 |
commit | cef5c4b76508d826959fb46f3f77ba0af029046f (patch) | |
tree | 26ac9844781fd8ebe348fd548eee23bb0ed15e1a /source/gameengine/Ketsji | |
parent | cddd38f539336052a8a6bfe96b1c5efae8b40165 (diff) |
Add Fh/Rot Fh to Bullet.
Diffstat (limited to 'source/gameengine/Ketsji')
-rw-r--r-- | source/gameengine/Ketsji/KX_BulletPhysicsController.cpp | 8 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp | 16 |
2 files changed, 20 insertions, 4 deletions
diff --git a/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp b/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp index d7bd1e9c7cd..3d20ce8a3a5 100644 --- a/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp +++ b/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp @@ -211,6 +211,9 @@ SG_Controller* KX_BulletPhysicsController::GetReplica(class SG_Node* destnode) //parentcontroller is here be able to avoid collisions between parent/child PHY_IPhysicsController* parentctrl = NULL; + KX_BulletPhysicsController* parentKxCtrl = NULL; + CcdPhysicsController* ccdParent = NULL; + if (destnode != destnode->GetRootSGParent()) { @@ -230,12 +233,15 @@ SG_Controller* KX_BulletPhysicsController::GetReplica(class SG_Node* destnode) KX_GameObject *clientgameobj = static_cast<KX_GameObject*>( (*childit)->GetSGClientObject()); if (clientgameobj) { - parentctrl = (KX_BulletPhysicsController*)clientgameobj->GetPhysicsController(); + parentKxCtrl = (KX_BulletPhysicsController*)clientgameobj->GetPhysicsController(); + parentctrl = parentKxCtrl; + ccdParent = parentKxCtrl; } } } } + physicsreplica->setParentCtrl(ccdParent); physicsreplica->PostProcessReplica(motionstate,parentctrl); physicsreplica->m_userdata = (PHY_IPhysicsController*)physicsreplica; return physicsreplica; diff --git a/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp b/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp index 68e0997aec0..0e7a6d92ec1 100644 --- a/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp +++ b/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp @@ -1028,10 +1028,16 @@ void KX_ConvertBulletObject( class KX_GameObject* gameobj, ci.m_do_anisotropic = shapeprops->m_do_anisotropic; ci.m_anisotropicFriction.setValue(shapeprops->m_friction_scaling[0],shapeprops->m_friction_scaling[1],shapeprops->m_friction_scaling[2]); - //smprop->m_do_fh = kxshapeprops->m_do_fh; - //smprop->m_do_rot_fh = kxshapeprops->m_do_rot_fh ; - +////////// + //do Fh, do Rot Fh + ci.m_do_fh = shapeprops->m_do_fh; + ci.m_do_rot_fh = shapeprops->m_do_rot_fh ; + ci.m_fh_damping = smmaterial->m_fh_damping; + ci.m_fh_distance = smmaterial->m_fh_distance; + ci.m_fh_normal = smmaterial->m_fh_normal; + ci.m_fh_spring = smmaterial->m_fh_spring; + ci.m_radius = objprop->m_radius; /////////////////// @@ -1098,6 +1104,10 @@ void KX_ConvertBulletObject( class KX_GameObject* gameobj, if (rbody && objprop->m_disableSleeping) rbody->setActivationState(DISABLE_DEACTIVATION); } + + CcdPhysicsController* parentCtrl = objprop->m_dynamic_parent ? (KX_BulletPhysicsController*)objprop->m_dynamic_parent->GetPhysicsController() : 0; + physicscontroller->setParentCtrl(parentCtrl); + //Now done directly in ci.m_collisionFlags so that it propagates to replica //if (objprop->m_ghost) |