diff options
author | Erwin Coumans <blender@erwincoumans.com> | 2005-08-05 21:00:32 +0400 |
---|---|---|
committer | Erwin Coumans <blender@erwincoumans.com> | 2005-08-05 21:00:32 +0400 |
commit | b6d9fbf0dbe44efee9309f09bc1a518a2cd67813 (patch) | |
tree | 43aaf1f693bec9849914001b9cf1fd1dce185de1 /source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp | |
parent | 0f044af97ef785f73e0aa2188716dcafd0c0d54e (diff) |
fixed the mouse-over sensor,
added raycast support for bullet (no triangle-mesh support, soon)
added python methods for 'getHitObject', getRayDirection, getHitPosition and getHitNormal for mouse over sensor,
which makes it easy for a shootout.blend demo :)
Diffstat (limited to 'source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp')
-rw-r--r-- | source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp b/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp index 6028efe86ee..53fd0db08d0 100644 --- a/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp +++ b/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp @@ -917,7 +917,6 @@ void KX_ConvertBulletObject( class KX_GameObject* gameobj, bm = new BoxShape(he); bm->CalculateLocalInertia(ci.m_mass,ci.m_localInertiaTensor); - bm->SetMargin(0.05 * halfExtents.length()); break; }; case KX_BOUNDCYLINDER: @@ -947,8 +946,6 @@ void KX_ConvertBulletObject( class KX_GameObject* gameobj, bm = new ConeShape(objprop->m_boundobject.c.m_radius,objprop->m_boundobject.c.m_height); bm->CalculateLocalInertia(ci.m_mass,ci.m_localInertiaTensor); - - break; } case KX_BOUNDPOLYTOPE: @@ -998,24 +995,33 @@ void KX_ConvertBulletObject( class KX_GameObject* gameobj, if (!bm) return; + bm->SetMargin(0.06); + ci.m_collisionShape = bm; ci.m_broadphaseHandle = 0; ci.m_friction = smmaterial->m_friction; ci.m_restitution = smmaterial->m_restitution; - - ci.m_linearDamping = shapeprops->m_lin_drag; - ci.m_angularDamping = shapeprops->m_ang_drag; + // drag / damping is inverted + ci.m_linearDamping = 1.f - shapeprops->m_lin_drag; + ci.m_angularDamping = 1.f - shapeprops->m_ang_drag; + //need a bit of damping, else system doesn't behave well + KX_BulletPhysicsController* physicscontroller = new KX_BulletPhysicsController(ci,dyna); env->addCcdPhysicsController( physicscontroller); gameobj->SetPhysicsController(physicscontroller); - physicscontroller->setNewClientInfo(gameobj); + physicscontroller->setNewClientInfo(gameobj->getClientInfo()); + bool isActor = objprop->m_isactor; + gameobj->getClientInfo()->m_type = (isActor ? KX_ClientObjectInfo::ACTOR : KX_ClientObjectInfo::STATIC); + // store materialname in auxinfo, needed for touchsensors + gameobj->getClientInfo()->m_auxilary_info = 0;//(matname.Length() ? (void*)(matname.ReadPtr()+2) : NULL); + + gameobj->GetSGNode()->AddSGController(physicscontroller); - bool isActor = objprop->m_isactor; STR_String materialname; if (meshobj) materialname = meshobj->GetMaterialName(0); |