diff options
Diffstat (limited to 'source/gameengine')
-rw-r--r-- | source/gameengine/Ketsji/KX_GameObject.cpp | 8 | ||||
-rw-r--r-- | source/gameengine/Physics/Bullet/CcdPhysicsController.cpp | 16 | ||||
-rw-r--r-- | source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp | 16 |
3 files changed, 17 insertions, 23 deletions
diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index 3740972ba29..f1c3fb89df2 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -49,6 +49,8 @@ typedef unsigned long uint_ptr; #include "RAS_IPolygonMaterial.h" #include "KX_BlenderMaterial.h" #include "KX_GameObject.h" +#include "KX_Camera.h" // only for their ::Type +#include "KX_Light.h" // only for their ::Type #include "RAS_MeshObject.h" #include "KX_MeshProxy.h" #include "KX_PolyProxy.h" @@ -2757,6 +2759,7 @@ void KX_GameObject::Relink(GEN_Map<GEN_HashedPtr, void*> *map_parameter) } } + bool ConvertPythonToGameObject(PyObject * value, KX_GameObject **object, bool py_none_ok, const char *error_prefix) { if (value==NULL) { @@ -2787,7 +2790,10 @@ bool ConvertPythonToGameObject(PyObject * value, KX_GameObject **object, bool py } } - if (PyObject_TypeCheck(value, &KX_GameObject::Type)) { + if ( PyObject_TypeCheck(value, &KX_GameObject::Type) || + PyObject_TypeCheck(value, &KX_LightObject::Type) || + PyObject_TypeCheck(value, &KX_Camera::Type) ) + { *object = static_cast<KX_GameObject*>BGE_PROXY_REF(value); /* sets the error */ diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp index 710d0656f6d..9a5f9644a47 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp @@ -185,12 +185,12 @@ void CcdPhysicsController::CreateRigidbody() rbci.m_restitution = m_cci.m_restitution; - int nodecount = 0; + + - int numtriangles = 1; btVector3 p(0,0,0);// = getOrigin(); - btScalar h = 1.f; + btSoftRigidDynamicsWorld* softDynaWorld = (btSoftRigidDynamicsWorld*)m_cci.m_physicsEnv->getDynamicsWorld(); @@ -794,7 +794,7 @@ void CcdPhysicsController::RelativeTranslate(float dlocX,float dlocY,float dloc m_object->setCollisionFlags(m_object->getCollisionFlags() | btCollisionObject::CF_KINEMATIC_OBJECT); } - btRigidBody* body = GetRigidBody(); + // btRigidBody* body = GetRigidBody(); // not used anymore btVector3 dloc(dlocX,dlocY,dlocZ); btTransform xform = m_object->getWorldTransform(); @@ -1388,8 +1388,6 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm, /* Convert blender geometry into bullet mesh, need these vars for mapping */ vector<bool> vert_tag_array(numverts, false); unsigned int tot_bt_verts= 0; - unsigned int orig_index; - int i; if (polytope) { @@ -1609,9 +1607,7 @@ bool CcdShapeConstructionInfo::SetProxy(CcdShapeConstructionInfo* shapeInfo) btCollisionShape* CcdShapeConstructionInfo::CreateBulletShape(btScalar margin) { btCollisionShape* collisionShape = 0; - btTriangleMeshShape* concaveShape = 0; - btCompoundShape* compoundShape = 0; - CcdShapeConstructionInfo* nextShapeInfo; + btCompoundShape* compoundShape = 0; if (m_shapeType == PHY_SHAPE_PROXY && m_shapeProxy != NULL) return m_shapeProxy->CreateBulletShape(margin); @@ -1684,7 +1680,7 @@ btCollisionShape* CcdShapeConstructionInfo::CreateBulletShape(btScalar margin) collisionMeshData->m_weldingThreshold = m_weldingThreshold1; bool removeDuplicateVertices=true; // m_vertexArray not in multiple of 3 anymore, use m_triFaceArray - for(int i=0; i<m_triFaceArray.size(); i+=3) { + for(unsigned int i=0; i<m_triFaceArray.size(); i+=3) { btScalar *bt = &m_vertexArray[3*m_triFaceArray[i]]; btVector3 v1(bt[0], bt[1], bt[2]); bt = &m_vertexArray[3*m_triFaceArray[i+1]]; diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp index 58720c8cc30..2dc7bffe618 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp @@ -1003,7 +1003,7 @@ struct FilterClosestRayResultCallback : public btCollisionWorld::ClosestRayResul virtual btScalar addSingleResult(btCollisionWorld::LocalRayResult& rayResult,bool normalInWorldSpace) { - CcdPhysicsController* curHit = static_cast<CcdPhysicsController*>(rayResult.m_collisionObject->getUserPointer()); + //CcdPhysicsController* curHit = static_cast<CcdPhysicsController*>(rayResult.m_collisionObject->getUserPointer()); // save shape information as ClosestRayResultCallback::AddSingleResult() does not do it if (rayResult.m_localShapeInfo) { @@ -1021,10 +1021,6 @@ struct FilterClosestRayResultCallback : public btCollisionWorld::ClosestRayResul PHY_IPhysicsController* CcdPhysicsEnvironment::rayTest(PHY_IRayCastFilterCallback &filterCallback, float fromX,float fromY,float fromZ, float toX,float toY,float toZ) { - - - float minFraction = 1.f; - btVector3 rayFrom(fromX,fromY,fromZ); btVector3 rayTo(toX,toY,toZ); @@ -1174,7 +1170,7 @@ struct OcclusionBuffer { m_initialized=false; m_occlusion = false; - m_buffer == NULL; + m_buffer = NULL; m_bufferSize = 0; } // multiplication of column major matrices: m=m1*m2 @@ -1282,8 +1278,7 @@ struct OcclusionBuffer static bool project(btVector4* p,int n) { for(int i=0;i<n;++i) - { - const btScalar iw=1/p[i][3]; + { p[i][2]=1/p[i][3]; p[i][0]*=p[i][2]; p[i][1]*=p[i][2]; @@ -1601,7 +1596,7 @@ struct OcclusionBuffer 6,5,1,2, 7,6,2,3, 5,4,0,1}; - for(int i=0;i<(sizeof(d)/sizeof(d[0]));) + for(unsigned int i=0;i<(sizeof(d)/sizeof(d[0]));) { const btVector4 p[]={ x[d[i++]], x[d[i++]], @@ -1954,9 +1949,6 @@ bool CcdPhysicsEnvironment::requestCollisionCallback(PHY_IPhysicsController* ctr void CcdPhysicsEnvironment::CallbackTriggers() { - - CcdPhysicsController* ctrl0=0,*ctrl1=0; - if (m_triggerCallbacks[PHY_OBJECT_RESPONSE] || (m_debugDrawer && (m_debugDrawer->getDebugMode() & btIDebugDraw::DBG_DrawContactPoints))) { //walk over all overlapping pairs, and if one of the involved bodies is registered for trigger callback, perform callback |