diff options
author | Erwin Coumans <blender@erwincoumans.com> | 2008-09-29 07:09:03 +0400 |
---|---|---|
committer | Erwin Coumans <blender@erwincoumans.com> | 2008-09-29 07:09:03 +0400 |
commit | 0b622fc07f1a19c4fbc72782f6000814b66b2088 (patch) | |
tree | a0cc270ca6238e42acb5845e1f735e07d9c55be8 /source/gameengine | |
parent | 25fc47aaf2a7898b81eb4617a1cd877832d675c2 (diff) |
added anisotropic friction support for Bullet. Both for static and dynamic objects
Diffstat (limited to 'source/gameengine')
3 files changed, 19 insertions, 1 deletions
diff --git a/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp b/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp index e4c7e7f9317..68e0997aec0 100644 --- a/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp +++ b/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp @@ -1025,6 +1025,14 @@ void KX_ConvertBulletObject( class KX_GameObject* gameobj, //need a bit of damping, else system doesn't behave well ci.m_inertiaFactor = shapeprops->m_inertia/0.4f;//defaults to 0.4, don't want to change behaviour + 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 ; + + + /////////////////// ci.m_gamesoftFlag = objprop->m_gamesoftFlag; diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp index 166731459e7..8ec040e89ee 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp @@ -500,6 +500,11 @@ void CcdPhysicsController::CreateRigidbody() body->setAngularFactor(0.f); } } + if (m_object && m_cci.m_do_anisotropic) + { + m_object->setAnisotropicFriction(m_cci.m_anisotropicFriction); + } + } static void DeleteBulletShape(btCollisionShape* shape) diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.h b/source/gameengine/Physics/Bullet/CcdPhysicsController.h index 1366764eb63..f001d6043cb 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsController.h +++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.h @@ -186,7 +186,9 @@ struct CcdConstructionInfo m_MotionState(0), m_shapeInfo(0), m_physicsEnv(0), - m_inertiaFactor(1.f) + m_inertiaFactor(1.f), + m_do_anisotropic(false), + m_anisotropicFriction(1.f,1.f,1.f) { } @@ -259,6 +261,9 @@ struct CcdConstructionInfo CcdPhysicsEnvironment* m_physicsEnv; //needed for self-replication float m_inertiaFactor;//tweak the inertia (hooked up to Blender 'formfactor' + bool m_do_anisotropic; + btVector3 m_anisotropicFriction; + }; |