forked from bartvdbraak/blender
preparation for bullet physics
This commit is contained in:
parent
3166974a67
commit
2d73b31aff
@ -394,6 +394,7 @@ void BLI_adddirstrings()
|
|||||||
else sprintf(files[num].size, "0");
|
else sprintf(files[num].size, "0");
|
||||||
|
|
||||||
strftime(datum, 32, "%d-%b-%y %R", tm);
|
strftime(datum, 32, "%d-%b-%y %R", tm);
|
||||||
|
//for visual studio 8, strftime(datum, 32, "%d-%b-%y ", tm);
|
||||||
|
|
||||||
if (st_size < 1000) {
|
if (st_size < 1000) {
|
||||||
sprintf(size, "%10d", (int) st_size);
|
sprintf(size, "%10d", (int) st_size);
|
||||||
|
@ -1,48 +1,96 @@
|
|||||||
/*
|
/*
|
||||||
|
|
||||||
* $Id$
|
* $Id$
|
||||||
|
|
||||||
*
|
*
|
||||||
|
|
||||||
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
|
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
|
||||||
|
|
||||||
*
|
*
|
||||||
|
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
|
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
|
||||||
* as published by the Free Software Foundation; either version 2
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
|
||||||
* of the License, or (at your option) any later version. The Blender
|
* of the License, or (at your option) any later version. The Blender
|
||||||
|
|
||||||
* Foundation also sells licenses for use in proprietary software under
|
* Foundation also sells licenses for use in proprietary software under
|
||||||
|
|
||||||
* the Blender License. See http://www.blender.org/BL/ for information
|
* the Blender License. See http://www.blender.org/BL/ for information
|
||||||
|
|
||||||
* about this.
|
* about this.
|
||||||
|
|
||||||
*
|
*
|
||||||
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
|
|
||||||
*
|
*
|
||||||
|
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
|
|
||||||
* along with this program; if not, write to the Free Software Foundation,
|
* along with this program; if not, write to the Free Software Foundation,
|
||||||
|
|
||||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*
|
*
|
||||||
|
|
||||||
* ***** END GPL/BL DUAL LICENSE BLOCK *****
|
* ***** END GPL/BL DUAL LICENSE BLOCK *****
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef ZBLUR_H
|
#ifndef ZBLUR_H
|
||||||
|
|
||||||
#define ZBLUR_H
|
#define ZBLUR_H
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
|
||||||
/* Includes */
|
|
||||||
/*-----------------------------------------------------------*/
|
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
/* Function */
|
|
||||||
|
/* Includes */
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Function */
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void add_zblur(void);
|
void add_zblur(void);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1858,7 +1858,7 @@ static void world_panel_mistaph(World *wrld)
|
|||||||
|
|
||||||
#if GAMEBLENDER == 1
|
#if GAMEBLENDER == 1
|
||||||
uiDefButI(block, MENU, 1,
|
uiDefButI(block, MENU, 1,
|
||||||
"Physics %t|None %x0|Sumo %x2|Ode %x4",
|
"Physics %t|None %x0|Sumo %x2|Ode %x4 |Bullet %x5",
|
||||||
10,180,140,19, &wrld->physicsEngine, 0, 0, 0, 0,
|
10,180,140,19, &wrld->physicsEngine, 0, 0, 0, 0,
|
||||||
"Physics Engine");
|
"Physics Engine");
|
||||||
|
|
||||||
@ -3112,7 +3112,6 @@ static void material_panel_material(Object *ob, Material *ma)
|
|||||||
uiDefIconBut(block, BUT, B_MATCOPY, ICON_COPYUP, 262,200,XIC,YIC, 0, 0, 0, 0, 0, "Copies Material to the buffer");
|
uiDefIconBut(block, BUT, B_MATCOPY, ICON_COPYUP, 262,200,XIC,YIC, 0, 0, 0, 0, 0, "Copies Material to the buffer");
|
||||||
uiSetButLock(id && id->lib, "Can't edit library data");
|
uiSetButLock(id && id->lib, "Can't edit library data");
|
||||||
uiDefIconBut(block, BUT, B_MATPASTE, ICON_PASTEUP, 283,200,XIC,YIC, 0, 0, 0, 0, 0, "Pastes Material from the buffer");
|
uiDefIconBut(block, BUT, B_MATPASTE, ICON_PASTEUP, 283,200,XIC,YIC, 0, 0, 0, 0, 0, "Pastes Material from the buffer");
|
||||||
uiClearButLock();
|
|
||||||
|
|
||||||
if(ob->actcol==0) ob->actcol= 1; /* because of TOG|BIT button */
|
if(ob->actcol==0) ob->actcol= 1; /* because of TOG|BIT button */
|
||||||
|
|
||||||
@ -3144,10 +3143,10 @@ static void material_panel_material(Object *ob, Material *ma)
|
|||||||
uiBlockEndAlign(block);
|
uiBlockEndAlign(block);
|
||||||
|
|
||||||
if(ob->totcol==0) return;
|
if(ob->totcol==0) return;
|
||||||
|
uiSetButLock(id->lib!=0, "Can't edit library data");
|
||||||
|
|
||||||
ma= give_current_material(ob, ob->actcol);
|
ma= give_current_material(ob, ob->actcol);
|
||||||
if(ma==NULL) return;
|
if(ma==0) return;
|
||||||
uiSetButLock(ma->id.lib!=NULL, "Can't edit library data");
|
|
||||||
|
|
||||||
if(ma->dynamode & MA_DRAW_DYNABUTS) {
|
if(ma->dynamode & MA_DRAW_DYNABUTS) {
|
||||||
uiBlockBeginAlign(block);
|
uiBlockBeginAlign(block);
|
||||||
@ -3265,8 +3264,6 @@ void material_panels()
|
|||||||
material_panel_material(ob, ma);
|
material_panel_material(ob, ma);
|
||||||
|
|
||||||
if(ma) {
|
if(ma) {
|
||||||
uiSetButLock(ma->id.lib!=NULL, "Can't edit library data");
|
|
||||||
|
|
||||||
material_panel_ramps(ma);
|
material_panel_ramps(ma);
|
||||||
material_panel_shading(ma);
|
material_panel_shading(ma);
|
||||||
if (G.scene->r.renderer==R_INTERN)
|
if (G.scene->r.renderer==R_INTERN)
|
||||||
|
@ -816,6 +816,12 @@ void BL_CreatePhysicsObjectNew(KX_GameObject* gameobj,
|
|||||||
|
|
||||||
switch (physics_engine)
|
switch (physics_engine)
|
||||||
{
|
{
|
||||||
|
#ifdef USE_BULLET
|
||||||
|
case UseBullet:
|
||||||
|
KX_ConvertBulletObject(gameobj, meshobj, kxscene, shapeprops, smmaterial, &objprop);
|
||||||
|
break;
|
||||||
|
|
||||||
|
#endif
|
||||||
#ifdef USE_SUMO_SOLID
|
#ifdef USE_SUMO_SOLID
|
||||||
case UseSumo:
|
case UseSumo:
|
||||||
KX_ConvertSumoObject(gameobj, meshobj, kxscene, shapeprops, smmaterial, &objprop);
|
KX_ConvertSumoObject(gameobj, meshobj, kxscene, shapeprops, smmaterial, &objprop);
|
||||||
@ -1331,6 +1337,8 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
|
|||||||
converter->RegisterWorldInfo(worldinfo);
|
converter->RegisterWorldInfo(worldinfo);
|
||||||
kxscene->SetWorldInfo(worldinfo);
|
kxscene->SetWorldInfo(worldinfo);
|
||||||
|
|
||||||
|
#define CONVERT_LOGIC
|
||||||
|
#ifdef CONVERT_LOGIC
|
||||||
// convert logic bricks, sensors, controllers and actuators
|
// convert logic bricks, sensors, controllers and actuators
|
||||||
for (i=0;i<logicbrick_conversionlist->GetCount();i++)
|
for (i=0;i<logicbrick_conversionlist->GetCount();i++)
|
||||||
{
|
{
|
||||||
@ -1353,6 +1361,8 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
|
|||||||
bool isInActiveLayer = (blenderobj->lay & activeLayerBitInfo)!=0;
|
bool isInActiveLayer = (blenderobj->lay & activeLayerBitInfo)!=0;
|
||||||
BL_ConvertSensors(blenderobj,gameobj,logicmgr,kxscene,keydev,executePriority,activeLayerBitInfo,isInActiveLayer,canvas,converter);
|
BL_ConvertSensors(blenderobj,gameobj,logicmgr,kxscene,keydev,executePriority,activeLayerBitInfo,isInActiveLayer,canvas,converter);
|
||||||
}
|
}
|
||||||
|
#endif //CONVERT_LOGIC
|
||||||
|
|
||||||
logicbrick_conversionlist->Release();
|
logicbrick_conversionlist->Release();
|
||||||
|
|
||||||
// Calculate the scene btree -
|
// Calculate the scene btree -
|
||||||
|
@ -45,6 +45,10 @@
|
|||||||
//to decide to use sumo/ode or dummy physics - defines USE_ODE
|
//to decide to use sumo/ode or dummy physics - defines USE_ODE
|
||||||
#include "KX_ConvertPhysicsObject.h"
|
#include "KX_ConvertPhysicsObject.h"
|
||||||
|
|
||||||
|
#ifdef USE_BULLET
|
||||||
|
#include "CcdPhysicsEnvironment.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef USE_ODE
|
#ifdef USE_ODE
|
||||||
#include "OdePhysicsEnvironment.h"
|
#include "OdePhysicsEnvironment.h"
|
||||||
#endif //USE_ODE
|
#endif //USE_ODE
|
||||||
@ -117,6 +121,11 @@ KX_BlenderSceneConverter::~KX_BlenderSceneConverter()
|
|||||||
#ifdef USE_SUMO_SOLID
|
#ifdef USE_SUMO_SOLID
|
||||||
KX_ClearSumoSharedShapes();
|
KX_ClearSumoSharedShapes();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_BULLET
|
||||||
|
KX_ClearBulletSharedShapes();
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -182,6 +191,11 @@ void KX_BlenderSceneConverter::ConvertScene(const STR_String& scenename,
|
|||||||
{
|
{
|
||||||
switch (blenderscene->world->physicsEngine)
|
switch (blenderscene->world->physicsEngine)
|
||||||
{
|
{
|
||||||
|
case WOPHY_BULLET:
|
||||||
|
{
|
||||||
|
physics_engine = UseBullet;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case WOPHY_ODE:
|
case WOPHY_ODE:
|
||||||
{
|
{
|
||||||
@ -209,6 +223,13 @@ void KX_BlenderSceneConverter::ConvertScene(const STR_String& scenename,
|
|||||||
|
|
||||||
switch (physics_engine)
|
switch (physics_engine)
|
||||||
{
|
{
|
||||||
|
#ifdef USE_BULLET
|
||||||
|
case UseBullet:
|
||||||
|
{
|
||||||
|
destinationscene->SetPhysicsEnvironment(new CcdPhysicsEnvironment());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef USE_SUMO_SOLID
|
#ifdef USE_SUMO_SOLID
|
||||||
case UseSumo:
|
case UseSumo:
|
||||||
|
138
source/gameengine/Ketsji/KX_BulletPhysicsController.cpp
Normal file
138
source/gameengine/Ketsji/KX_BulletPhysicsController.cpp
Normal file
@ -0,0 +1,138 @@
|
|||||||
|
#include "KX_BulletPhysicsController.h"
|
||||||
|
|
||||||
|
#include "Dynamics/RigidBody.h"
|
||||||
|
|
||||||
|
KX_BulletPhysicsController::KX_BulletPhysicsController (const CcdConstructionInfo& ci, bool dyna)
|
||||||
|
: KX_IPhysicsController(dyna,(PHY_IPhysicsController*)this),
|
||||||
|
CcdPhysicsController(ci)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
KX_BulletPhysicsController::~KX_BulletPhysicsController ()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void KX_BulletPhysicsController::resolveCombinedVelocities(float linvelX,float linvelY,float linvelZ,float angVelX,float angVelY,float angVelZ)
|
||||||
|
{
|
||||||
|
CcdPhysicsController::resolveCombinedVelocities(linvelX,linvelY,linvelZ,angVelX,angVelY,angVelZ);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////////
|
||||||
|
// KX_IPhysicsController interface
|
||||||
|
////////////////////////////////////
|
||||||
|
|
||||||
|
void KX_BulletPhysicsController::applyImpulse(const MT_Point3& attach, const MT_Vector3& impulse)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void KX_BulletPhysicsController::SetObject (SG_IObject* object)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void KX_BulletPhysicsController::RelativeTranslate(const MT_Vector3& dloc,bool local)
|
||||||
|
{
|
||||||
|
CcdPhysicsController::RelativeTranslate(dloc[0],dloc[1],dloc[2],local);
|
||||||
|
|
||||||
|
}
|
||||||
|
void KX_BulletPhysicsController::RelativeRotate(const MT_Matrix3x3& drot,bool local)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void KX_BulletPhysicsController::ApplyTorque(const MT_Vector3& torque,bool local)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void KX_BulletPhysicsController::ApplyForce(const MT_Vector3& force,bool local)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
MT_Vector3 KX_BulletPhysicsController::GetLinearVelocity()
|
||||||
|
{
|
||||||
|
assert(0);
|
||||||
|
return MT_Vector3(0.f,0.f,0.f);
|
||||||
|
|
||||||
|
}
|
||||||
|
MT_Vector3 KX_BulletPhysicsController::GetVelocity(const MT_Point3& pos)
|
||||||
|
{
|
||||||
|
assert(0);
|
||||||
|
return MT_Vector3(0.f,0.f,0.f);
|
||||||
|
|
||||||
|
}
|
||||||
|
void KX_BulletPhysicsController::SetAngularVelocity(const MT_Vector3& ang_vel,bool local)
|
||||||
|
{
|
||||||
|
CcdPhysicsController::SetAngularVelocity(ang_vel.x(),ang_vel.y(),ang_vel.z(),local);
|
||||||
|
|
||||||
|
}
|
||||||
|
void KX_BulletPhysicsController::SetLinearVelocity(const MT_Vector3& lin_vel,bool local)
|
||||||
|
{
|
||||||
|
CcdPhysicsController::SetLinearVelocity(lin_vel.x(),lin_vel.y(),lin_vel.z(),local);
|
||||||
|
}
|
||||||
|
void KX_BulletPhysicsController::getOrientation(MT_Quaternion& orn)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void KX_BulletPhysicsController::setOrientation(const MT_Quaternion& orn)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void KX_BulletPhysicsController::setPosition(const MT_Point3& pos)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
void KX_BulletPhysicsController::setScaling(const MT_Vector3& scaling)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
MT_Scalar KX_BulletPhysicsController::GetMass()
|
||||||
|
{
|
||||||
|
|
||||||
|
MT_Scalar invmass = GetRigidBody()->getInvMass();
|
||||||
|
if (invmass)
|
||||||
|
return 1.f/invmass;
|
||||||
|
return 0.f;
|
||||||
|
|
||||||
|
}
|
||||||
|
MT_Vector3 KX_BulletPhysicsController::getReactionForce()
|
||||||
|
{
|
||||||
|
assert(0);
|
||||||
|
return MT_Vector3(0.f,0.f,0.f);
|
||||||
|
}
|
||||||
|
void KX_BulletPhysicsController::setRigidBody(bool rigid)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void KX_BulletPhysicsController::SuspendDynamics()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void KX_BulletPhysicsController::RestoreDynamics()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
SG_Controller* KX_BulletPhysicsController::GetReplica(class SG_Node* destnode)
|
||||||
|
{
|
||||||
|
assert(0);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void KX_BulletPhysicsController::SetSumoTransform(bool nondynaonly)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// todo: remove next line !
|
||||||
|
void KX_BulletPhysicsController::SetSimulatedTime(double time)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// call from scene graph to update
|
||||||
|
bool KX_BulletPhysicsController::Update(double time)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// todo: check this code
|
||||||
|
//if (GetMass())
|
||||||
|
//{
|
||||||
|
// return false;//true;
|
||||||
|
// }
|
||||||
|
// return false;
|
||||||
|
}
|
||||||
|
|
69
source/gameengine/Ketsji/KX_BulletPhysicsController.h
Normal file
69
source/gameengine/Ketsji/KX_BulletPhysicsController.h
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
#ifndef KX_BULLET2PHYSICS_CONTROLLER
|
||||||
|
#define KX_BULLET2PHYSICS_CONTROLLER
|
||||||
|
|
||||||
|
|
||||||
|
#include "KX_IPhysicsController.h"
|
||||||
|
#include "CcdPhysicsController.h"
|
||||||
|
|
||||||
|
class KX_BulletPhysicsController : public KX_IPhysicsController ,public CcdPhysicsController
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
KX_BulletPhysicsController (const CcdConstructionInfo& ci, bool dyna);
|
||||||
|
virtual ~KX_BulletPhysicsController ();
|
||||||
|
|
||||||
|
///////////////////////////////////
|
||||||
|
// KX_IPhysicsController interface
|
||||||
|
////////////////////////////////////
|
||||||
|
|
||||||
|
virtual void applyImpulse(const MT_Point3& attach, const MT_Vector3& impulse);
|
||||||
|
virtual void SetObject (SG_IObject* object);
|
||||||
|
|
||||||
|
virtual void RelativeTranslate(const MT_Vector3& dloc,bool local);
|
||||||
|
virtual void RelativeRotate(const MT_Matrix3x3& drot,bool local);
|
||||||
|
virtual void ApplyTorque(const MT_Vector3& torque,bool local);
|
||||||
|
virtual void ApplyForce(const MT_Vector3& force,bool local);
|
||||||
|
virtual MT_Vector3 GetLinearVelocity();
|
||||||
|
virtual MT_Vector3 GetVelocity(const MT_Point3& pos);
|
||||||
|
virtual void SetAngularVelocity(const MT_Vector3& ang_vel,bool local);
|
||||||
|
virtual void SetLinearVelocity(const MT_Vector3& lin_vel,bool local);
|
||||||
|
virtual void getOrientation(MT_Quaternion& orn);
|
||||||
|
virtual void setOrientation(const MT_Quaternion& orn);
|
||||||
|
virtual void setPosition(const MT_Point3& pos);
|
||||||
|
virtual void setScaling(const MT_Vector3& scaling);
|
||||||
|
virtual MT_Scalar GetMass();
|
||||||
|
virtual MT_Vector3 getReactionForce();
|
||||||
|
virtual void setRigidBody(bool rigid);
|
||||||
|
|
||||||
|
virtual void resolveCombinedVelocities(float linvelX,float linvelY,float linvelZ,float angVelX,float angVelY,float angVelZ);
|
||||||
|
|
||||||
|
virtual void SuspendDynamics();
|
||||||
|
virtual void RestoreDynamics();
|
||||||
|
|
||||||
|
virtual SG_Controller* GetReplica(class SG_Node* destnode);
|
||||||
|
|
||||||
|
void SetDyna(bool isDynamic) {
|
||||||
|
m_bDyna = isDynamic;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
virtual void SetSumoTransform(bool nondynaonly);
|
||||||
|
// todo: remove next line !
|
||||||
|
virtual void SetSimulatedTime(double time);
|
||||||
|
|
||||||
|
// call from scene graph to update
|
||||||
|
virtual bool Update(double time);
|
||||||
|
void* GetUserData() { return m_userdata;}
|
||||||
|
|
||||||
|
void
|
||||||
|
SetOption(
|
||||||
|
int option,
|
||||||
|
int value
|
||||||
|
){
|
||||||
|
// intentionally empty
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //KX_BULLET2PHYSICS_CONTROLLER
|
@ -35,6 +35,7 @@
|
|||||||
/* These are defined by the build system... */
|
/* These are defined by the build system... */
|
||||||
//#define USE_SUMO_SOLID
|
//#define USE_SUMO_SOLID
|
||||||
//#define USE_ODE
|
//#define USE_ODE
|
||||||
|
//#define USE_BULLET
|
||||||
|
|
||||||
class RAS_MeshObject;
|
class RAS_MeshObject;
|
||||||
class KX_Scene;
|
class KX_Scene;
|
||||||
@ -115,5 +116,18 @@ bool KX_ReInstanceShapeFromMesh(RAS_MeshObject* meshobj);
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_BULLET
|
||||||
|
|
||||||
|
void KX_ConvertBulletObject( class KX_GameObject* gameobj,
|
||||||
|
class RAS_MeshObject* meshobj,
|
||||||
|
class KX_Scene* kxscene,
|
||||||
|
struct PHY_ShapeProps* shapeprops,
|
||||||
|
struct PHY_MaterialProps* smmaterial,
|
||||||
|
struct KX_ObjectProperties* objprop);
|
||||||
|
|
||||||
|
void KX_ClearBulletSharedShapes();
|
||||||
|
//bool KX_ReInstanceShapeFromMesh(RAS_MeshObject* meshobj);
|
||||||
|
|
||||||
|
#endif
|
||||||
#endif //KX_CONVERTPHYSICSOBJECTS
|
#endif //KX_CONVERTPHYSICSOBJECTS
|
||||||
|
|
||||||
|
@ -63,6 +63,7 @@
|
|||||||
// USE_SUMO_SOLID is defined in headerfile KX_ConvertPhysicsObject.h
|
// USE_SUMO_SOLID is defined in headerfile KX_ConvertPhysicsObject.h
|
||||||
#ifdef USE_SUMO_SOLID
|
#ifdef USE_SUMO_SOLID
|
||||||
|
|
||||||
|
|
||||||
#include "SumoPhysicsEnvironment.h"
|
#include "SumoPhysicsEnvironment.h"
|
||||||
#include "KX_SumoPhysicsController.h"
|
#include "KX_SumoPhysicsController.h"
|
||||||
|
|
||||||
@ -577,6 +578,10 @@ void KX_ClearSumoSharedShapes()
|
|||||||
map_gamemesh_to_instance.clear();
|
map_gamemesh_to_instance.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif //USE_SUMO_SOLID
|
#endif //USE_SUMO_SOLID
|
||||||
|
|
||||||
|
|
||||||
@ -651,3 +656,390 @@ void KX_ConvertODEEngineObject(KX_GameObject* gameobj,
|
|||||||
|
|
||||||
|
|
||||||
#endif // USE_ODE
|
#endif // USE_ODE
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef USE_BULLET
|
||||||
|
|
||||||
|
#include "CcdPhysicsEnvironment.h"
|
||||||
|
#include "CcdPhysicsController.h"
|
||||||
|
|
||||||
|
#include "KX_BulletPhysicsController.h"
|
||||||
|
#include "CollisionShapes/BoxShape.h"
|
||||||
|
#include "CollisionShapes/SphereShape.h"
|
||||||
|
#include "CollisionShapes/TriangleMeshInterface.h"
|
||||||
|
#include "CollisionShapes/ConeShape.h"
|
||||||
|
#include "CollisionShapes/ConvexShape.h"
|
||||||
|
#include "CollisionShapes/CylinderShape.h"
|
||||||
|
#include "CollisionShapes/MultiSphereShape.h"
|
||||||
|
#include "CollisionShapes/ConvexHullShape.h"
|
||||||
|
#include "CollisionShapes/TriangleMesh.h"
|
||||||
|
#include "CollisionShapes/TriangleMeshShape.h"
|
||||||
|
|
||||||
|
|
||||||
|
static GEN_Map<GEN_HashedPtr,CollisionShape*> map_gamemesh_to_bulletshape;
|
||||||
|
|
||||||
|
// forward declarations
|
||||||
|
static CollisionShape* CreateBulletShapeFromMesh(RAS_MeshObject* meshobj, bool polytope)
|
||||||
|
{
|
||||||
|
if (!meshobj)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
CollisionShape* collisionMeshShape = 0;
|
||||||
|
ConvexHullShape* convexHullShape = 0;
|
||||||
|
TriangleMeshShape* concaveShape = 0;
|
||||||
|
|
||||||
|
TriangleMesh* collisionMeshData = 0;
|
||||||
|
|
||||||
|
//see if there is any polygons, if not, bail out.
|
||||||
|
|
||||||
|
int numUsedPolygons = 0;
|
||||||
|
int numPoints = 0;
|
||||||
|
SimdVector3* points = 0;
|
||||||
|
|
||||||
|
CollisionShape** shapeptr = map_gamemesh_to_bulletshape[GEN_HashedPtr(meshobj)];
|
||||||
|
|
||||||
|
// Mesh has already been converted: reuse
|
||||||
|
if (shapeptr)
|
||||||
|
{
|
||||||
|
//return *shapeptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mesh has no polygons!
|
||||||
|
int numpolys = meshobj->NumPolygons();
|
||||||
|
if (!numpolys)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Count the number of collision polygons and check they all come from the same
|
||||||
|
// vertex array
|
||||||
|
int numvalidpolys = 0;
|
||||||
|
int vtxarray = -1;
|
||||||
|
RAS_IPolyMaterial *poly_material = NULL;
|
||||||
|
bool reinstance = true;
|
||||||
|
|
||||||
|
for (int p=0; p<numpolys; p++)
|
||||||
|
{
|
||||||
|
RAS_Polygon* poly = meshobj->GetPolygon(p);
|
||||||
|
|
||||||
|
// only add polygons that have the collisionflag set
|
||||||
|
if (poly->IsCollider())
|
||||||
|
{
|
||||||
|
// check polygon is from the same vertex array
|
||||||
|
if (poly->GetVertexIndexBase().m_vtxarray != vtxarray)
|
||||||
|
{
|
||||||
|
if (vtxarray < 0)
|
||||||
|
vtxarray = poly->GetVertexIndexBase().m_vtxarray;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
reinstance = false;
|
||||||
|
vtxarray = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// check poly is from the same material
|
||||||
|
if (poly->GetMaterial()->GetPolyMaterial() != poly_material)
|
||||||
|
{
|
||||||
|
if (poly_material)
|
||||||
|
{
|
||||||
|
reinstance = false;
|
||||||
|
poly_material = NULL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
poly_material = poly->GetMaterial()->GetPolyMaterial();
|
||||||
|
}
|
||||||
|
|
||||||
|
// count the number of collision polys
|
||||||
|
numvalidpolys++;
|
||||||
|
|
||||||
|
// We have one collision poly, and we can't reinstance, so we
|
||||||
|
// might as well break here.
|
||||||
|
if (!reinstance)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// No collision polygons
|
||||||
|
if (numvalidpolys < 1)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
|
||||||
|
if (polytope)
|
||||||
|
{
|
||||||
|
convexHullShape = new ConvexHullShape(points,numPoints);
|
||||||
|
collisionMeshShape = convexHullShape;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
collisionMeshData = new TriangleMesh();
|
||||||
|
concaveShape = new TriangleMeshShape(collisionMeshData);
|
||||||
|
collisionMeshShape = concaveShape;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
numvalidpolys = 0;
|
||||||
|
|
||||||
|
for (int p2=0; p2<numpolys; p2++)
|
||||||
|
{
|
||||||
|
RAS_Polygon* poly = meshobj->GetPolygon(p2);
|
||||||
|
|
||||||
|
// only add polygons that have the collisionflag set
|
||||||
|
if (poly->IsCollider())
|
||||||
|
{
|
||||||
|
//Bullet can raycast any shape, so
|
||||||
|
if (polytope)
|
||||||
|
{
|
||||||
|
for (int i=0;i<poly->VertexCount();i++)
|
||||||
|
{
|
||||||
|
const float* vtx = meshobj->GetVertex(poly->GetVertexIndexBase().m_vtxarray,
|
||||||
|
poly->GetVertexIndexBase().m_indexarray[i],
|
||||||
|
poly->GetMaterial()->GetPolyMaterial())->getLocalXYZ();
|
||||||
|
SimdPoint3 point(vtx[0],vtx[1],vtx[2]);
|
||||||
|
convexHullShape->AddPoint(point);
|
||||||
|
}
|
||||||
|
if (poly->VertexCount())
|
||||||
|
numvalidpolys++;
|
||||||
|
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
{
|
||||||
|
const float* vtx = meshobj->GetVertex(poly->GetVertexIndexBase().m_vtxarray,
|
||||||
|
poly->GetVertexIndexBase().m_indexarray[2],
|
||||||
|
poly->GetMaterial()->GetPolyMaterial())->getLocalXYZ();
|
||||||
|
SimdPoint3 vertex0(vtx[0],vtx[1],vtx[2]);
|
||||||
|
vtx = meshobj->GetVertex(poly->GetVertexIndexBase().m_vtxarray,
|
||||||
|
poly->GetVertexIndexBase().m_indexarray[1],
|
||||||
|
poly->GetMaterial()->GetPolyMaterial())->getLocalXYZ();
|
||||||
|
SimdPoint3 vertex1(vtx[0],vtx[1],vtx[2]);
|
||||||
|
vtx = meshobj->GetVertex(poly->GetVertexIndexBase().m_vtxarray,
|
||||||
|
poly->GetVertexIndexBase().m_indexarray[0],
|
||||||
|
poly->GetMaterial()->GetPolyMaterial())->getLocalXYZ();
|
||||||
|
SimdPoint3 vertex2(vtx[0],vtx[1],vtx[2]);
|
||||||
|
collisionMeshData->AddTriangle(vertex0,vertex1,vertex2);
|
||||||
|
numvalidpolys++;
|
||||||
|
}
|
||||||
|
if (poly->VertexCount() == 4)
|
||||||
|
{
|
||||||
|
const float* vtx = meshobj->GetVertex(poly->GetVertexIndexBase().m_vtxarray,
|
||||||
|
poly->GetVertexIndexBase().m_indexarray[3],
|
||||||
|
poly->GetMaterial()->GetPolyMaterial())->getLocalXYZ();
|
||||||
|
SimdPoint3 vertex0(vtx[0],vtx[1],vtx[2]);
|
||||||
|
vtx = meshobj->GetVertex(poly->GetVertexIndexBase().m_vtxarray,
|
||||||
|
poly->GetVertexIndexBase().m_indexarray[2],
|
||||||
|
poly->GetMaterial()->GetPolyMaterial())->getLocalXYZ();
|
||||||
|
SimdPoint3 vertex1(vtx[0],vtx[1],vtx[2]);
|
||||||
|
vtx = meshobj->GetVertex(poly->GetVertexIndexBase().m_vtxarray,
|
||||||
|
poly->GetVertexIndexBase().m_indexarray[0],
|
||||||
|
poly->GetMaterial()->GetPolyMaterial())->getLocalXYZ();
|
||||||
|
SimdPoint3 vertex2(vtx[0],vtx[1],vtx[2]);
|
||||||
|
collisionMeshData->AddTriangle(vertex0,vertex1,vertex2);
|
||||||
|
numvalidpolys++;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (numvalidpolys > 0)
|
||||||
|
{
|
||||||
|
//map_gamemesh_to_bulletshape.insert(GEN_HashedPtr(meshobj),collisionMeshShape);
|
||||||
|
return collisionMeshShape;
|
||||||
|
}
|
||||||
|
|
||||||
|
delete collisionMeshShape;
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void KX_ConvertBulletObject( class KX_GameObject* gameobj,
|
||||||
|
class RAS_MeshObject* meshobj,
|
||||||
|
class KX_Scene* kxscene,
|
||||||
|
struct PHY_ShapeProps* shapeprops,
|
||||||
|
struct PHY_MaterialProps* smmaterial,
|
||||||
|
struct KX_ObjectProperties* objprop)
|
||||||
|
{
|
||||||
|
|
||||||
|
CcdPhysicsEnvironment* env = (CcdPhysicsEnvironment*)kxscene->GetPhysicsEnvironment();
|
||||||
|
assert(env);
|
||||||
|
|
||||||
|
|
||||||
|
bool dyna = false;
|
||||||
|
CcdConstructionInfo ci;
|
||||||
|
class PHY_IMotionState* motionstate = new KX_MotionState(gameobj->GetSGNode());
|
||||||
|
|
||||||
|
ci.m_MotionState = motionstate;
|
||||||
|
ci.m_gravity = SimdVector3(0,0,0);
|
||||||
|
ci.m_localInertiaTensor =SimdVector3(0,0,0);
|
||||||
|
ci.m_mass = objprop->m_dyna ? shapeprops->m_mass : 0.f;
|
||||||
|
|
||||||
|
ci.m_localInertiaTensor = SimdVector3(ci.m_mass/3.f,ci.m_mass/3.f,ci.m_mass/3.f);
|
||||||
|
|
||||||
|
SimdTransform trans;
|
||||||
|
trans.setIdentity();
|
||||||
|
|
||||||
|
CollisionShape* bm = 0;
|
||||||
|
|
||||||
|
switch (objprop->m_boundclass)
|
||||||
|
{
|
||||||
|
case KX_BOUNDSPHERE:
|
||||||
|
{
|
||||||
|
float radius = objprop->m_radius;
|
||||||
|
SimdVector3 inertiaHalfExtents (
|
||||||
|
radius,
|
||||||
|
radius,
|
||||||
|
radius);
|
||||||
|
|
||||||
|
//blender doesn't support multisphere, but for testing:
|
||||||
|
|
||||||
|
//bm = new MultiSphereShape(inertiaHalfExtents,,&trans.getOrigin(),&radius,1);
|
||||||
|
bm = new SphereShape(objprop->m_radius);
|
||||||
|
bm->CalculateLocalInertia(ci.m_mass,ci.m_localInertiaTensor);
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
case KX_BOUNDBOX:
|
||||||
|
{
|
||||||
|
MT_Vector3 halfExtents (
|
||||||
|
objprop->m_boundobject.box.m_extends[0],
|
||||||
|
objprop->m_boundobject.box.m_extends[1],
|
||||||
|
objprop->m_boundobject.box.m_extends[2]);
|
||||||
|
|
||||||
|
halfExtents /= 2.f;
|
||||||
|
|
||||||
|
SimdVector3 he (halfExtents[0]-CONVEX_DISTANCE_MARGIN ,halfExtents[1]-CONVEX_DISTANCE_MARGIN ,halfExtents[2]-CONVEX_DISTANCE_MARGIN );
|
||||||
|
he = he.absolute();
|
||||||
|
|
||||||
|
|
||||||
|
bm = new BoxShape(he);
|
||||||
|
bm->CalculateLocalInertia(ci.m_mass,ci.m_localInertiaTensor);
|
||||||
|
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
case KX_BOUNDCYLINDER:
|
||||||
|
{
|
||||||
|
SimdVector3 halfExtents (
|
||||||
|
objprop->m_boundobject.c.m_radius,
|
||||||
|
objprop->m_boundobject.c.m_radius,
|
||||||
|
objprop->m_boundobject.c.m_height * 0.5f
|
||||||
|
);
|
||||||
|
bm = new CylinderShapeZ(halfExtents);
|
||||||
|
bm->CalculateLocalInertia(ci.m_mass,ci.m_localInertiaTensor);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case KX_BOUNDCONE:
|
||||||
|
{
|
||||||
|
SimdVector3 halfExtents (objprop->m_boundobject.box.m_extends[0],
|
||||||
|
objprop->m_boundobject.box.m_extends[1],
|
||||||
|
objprop->m_boundobject.box.m_extends[2]);
|
||||||
|
|
||||||
|
|
||||||
|
halfExtents /= 2.f;
|
||||||
|
SimdVector3& he = halfExtents;
|
||||||
|
SimdTransform& tr = trans;
|
||||||
|
|
||||||
|
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:
|
||||||
|
{
|
||||||
|
bm = CreateBulletShapeFromMesh(meshobj,true);
|
||||||
|
if (bm)
|
||||||
|
{
|
||||||
|
bm->CalculateLocalInertia(ci.m_mass,ci.m_localInertiaTensor);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case KX_BOUNDMESH:
|
||||||
|
{
|
||||||
|
if (!ci.m_mass)
|
||||||
|
{
|
||||||
|
bm = CreateBulletShapeFromMesh(meshobj,false);
|
||||||
|
ci.m_localInertiaTensor.setValue(0.f,0.f,0.f);
|
||||||
|
//no moving concave meshes, so don't bother calculating inertia
|
||||||
|
//bm->CalculateLocalInertia(ci.m_mass,ci.m_localInertiaTensor);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
//interpret the shape as a concave triangle-mesh
|
||||||
|
{
|
||||||
|
if (meshobj)
|
||||||
|
{
|
||||||
|
// assert(0);
|
||||||
|
|
||||||
|
/*
|
||||||
|
meshobj->ScheduleCollisionPolygons();
|
||||||
|
|
||||||
|
KX_DeformableMesh* gfxmesh = new KX_DeformableMesh(meshobj);
|
||||||
|
gfxmesh->sendFixedMapping();
|
||||||
|
//trianglemesh
|
||||||
|
bm = new TriangleMeshInterface(gfxmesh,trans);
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ci.m_localInertiaTensor.setValue(0.1f,0.1f,0.1f);
|
||||||
|
|
||||||
|
if (!bm)
|
||||||
|
return;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
KX_BulletPhysicsController* physicscontroller = new KX_BulletPhysicsController(ci,dyna);
|
||||||
|
env->addCcdPhysicsController( physicscontroller);
|
||||||
|
|
||||||
|
|
||||||
|
gameobj->SetPhysicsController(physicscontroller);
|
||||||
|
physicscontroller->setNewClientInfo(gameobj);
|
||||||
|
gameobj->GetSGNode()->AddSGController(physicscontroller);
|
||||||
|
|
||||||
|
bool isActor = objprop->m_isactor;
|
||||||
|
STR_String materialname;
|
||||||
|
if (meshobj)
|
||||||
|
materialname = meshobj->GetMaterialName(0);
|
||||||
|
|
||||||
|
const char* matname = materialname.ReadPtr();
|
||||||
|
|
||||||
|
|
||||||
|
physicscontroller->SetObject(gameobj->GetSGNode());
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void KX_ClearBulletSharedShapes()
|
||||||
|
{
|
||||||
|
int numshapes = map_gamemesh_to_bulletshape.size();
|
||||||
|
int i;
|
||||||
|
CollisionShape*shape=0;
|
||||||
|
for (i=0;i<numshapes ;i++)
|
||||||
|
{
|
||||||
|
shape = *map_gamemesh_to_bulletshape.at(i);
|
||||||
|
//delete shape;
|
||||||
|
}
|
||||||
|
|
||||||
|
map_gamemesh_to_bulletshape.clear();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@ -321,7 +321,7 @@ void KX_KetsjiEngine::NextFrame()
|
|||||||
m_deltatime += curtime - m_previoustime;
|
m_deltatime += curtime - m_previoustime;
|
||||||
float realDeltaTime = curtime - m_previoustime;
|
float realDeltaTime = curtime - m_previoustime;
|
||||||
|
|
||||||
m_previoustime = curtime;
|
|
||||||
double localtime = curtime - m_deltatime;
|
double localtime = curtime - m_deltatime;
|
||||||
|
|
||||||
// Compute the number of logic frames to do each update (fixed tic bricks)
|
// Compute the number of logic frames to do each update (fixed tic bricks)
|
||||||
@ -332,6 +332,7 @@ void KX_KetsjiEngine::NextFrame()
|
|||||||
|
|
||||||
while (frames)
|
while (frames)
|
||||||
{
|
{
|
||||||
|
|
||||||
localtime += 1.0/m_ticrate;
|
localtime += 1.0/m_ticrate;
|
||||||
for (sceneit = m_scenes.begin();sceneit != m_scenes.end(); ++sceneit)
|
for (sceneit = m_scenes.begin();sceneit != m_scenes.end(); ++sceneit)
|
||||||
// for each scene, call the proceed functions
|
// for each scene, call the proceed functions
|
||||||
@ -388,6 +389,7 @@ void KX_KetsjiEngine::NextFrame()
|
|||||||
// many iterations of the physics solver.
|
// many iterations of the physics solver.
|
||||||
m_logger->StartLog(tc_physics, m_kxsystem->GetTimeInSeconds(), true);
|
m_logger->StartLog(tc_physics, m_kxsystem->GetTimeInSeconds(), true);
|
||||||
scene->GetPhysicsEnvironment()->proceedDeltaTime(localtime,realDeltaTime);
|
scene->GetPhysicsEnvironment()->proceedDeltaTime(localtime,realDeltaTime);
|
||||||
|
m_previoustime = curtime;
|
||||||
} // suspended
|
} // suspended
|
||||||
|
|
||||||
DoSound(scene);
|
DoSound(scene);
|
||||||
|
@ -39,7 +39,8 @@ enum e_PhysicsEngine
|
|||||||
UseEnji = 1,
|
UseEnji = 1,
|
||||||
UseSumo = 2,
|
UseSumo = 2,
|
||||||
UseDynamo = 3,
|
UseDynamo = 3,
|
||||||
UseODE = 4
|
UseODE = 4,
|
||||||
|
UseBullet = 5,
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //__KX_PHYSICSENGINEENUMS
|
#endif //__KX_PHYSICSENGINEENUMS
|
||||||
|
@ -207,7 +207,7 @@ KX_Scene::~KX_Scene()
|
|||||||
{
|
{
|
||||||
delete m_bucketmanager;
|
delete m_bucketmanager;
|
||||||
}
|
}
|
||||||
Py_DECREF(m_attrlist);
|
//Py_DECREF(m_attrlist);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
* ***** END GPL/BL DUAL LICENSE BLOCK *****
|
* ***** END GPL/BL DUAL LICENSE BLOCK *****
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define USE_ODE
|
||||||
#ifdef USE_ODE
|
#ifdef USE_ODE
|
||||||
|
|
||||||
#include "OdePhysicsController.h"
|
#include "OdePhysicsController.h"
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
#include "OdePhysicsController.h"
|
#include "OdePhysicsController.h"
|
||||||
|
|
||||||
// Ode
|
// Ode
|
||||||
#include <ode/config.h>
|
//#include <ode/config.h>
|
||||||
#include <ode/ode.h>
|
#include <ode/ode.h>
|
||||||
#include <../ode/src/joint.h>
|
#include <../ode/src/joint.h>
|
||||||
#include <ode/odemath.h>
|
#include <ode/odemath.h>
|
||||||
@ -105,7 +105,9 @@ bool ODEPhysicsEnvironment::proceedDeltaTime(double curTime,float timeStep1)
|
|||||||
int m_odeContacts = GetNumOdeContacts();
|
int m_odeContacts = GetNumOdeContacts();
|
||||||
|
|
||||||
//physics integrator + resolver update
|
//physics integrator + resolver update
|
||||||
dWorldStep (m_OdeWorld,deltaTime);
|
//dWorldStep (m_OdeWorld,deltaTime);
|
||||||
|
dWorldQuickStep (m_OdeWorld,deltaTime);
|
||||||
|
//dWorldID w, dReal stepsize)
|
||||||
|
|
||||||
//clear collision points
|
//clear collision points
|
||||||
this->ClearOdeContactGroup();
|
this->ClearOdeContactGroup();
|
||||||
|
@ -32,15 +32,6 @@
|
|||||||
#ifndef __PHY_DYNAMIC_TYPES
|
#ifndef __PHY_DYNAMIC_TYPES
|
||||||
#define __PHY_DYNAMIC_TYPES
|
#define __PHY_DYNAMIC_TYPES
|
||||||
|
|
||||||
/// PHY_ScalarType enumerates possible scalar types.
|
|
||||||
/// See the PHY_IMeshInterface for its use
|
|
||||||
typedef enum PHY_ScalarType {
|
|
||||||
PHY_FLOAT,
|
|
||||||
PHY_DOUBLE,
|
|
||||||
PHY_INTEGER,
|
|
||||||
PHY_SHORT,
|
|
||||||
PHY_FIXEDPOINT88
|
|
||||||
} PHY_ScalarType;
|
|
||||||
|
|
||||||
class PHY_ResponseTable;
|
class PHY_ResponseTable;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user