2002-10-12 11:37:38 +00:00
|
|
|
/**
|
|
|
|
* $Id$
|
|
|
|
*
|
2008-04-16 22:40:48 +00:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
2008-04-16 22:40:48 +00:00
|
|
|
* of the License, or (at your option) any later version.
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* The Original Code is: all of this file.
|
|
|
|
*
|
|
|
|
* Contributor(s): none yet.
|
|
|
|
*
|
2008-04-16 22:40:48 +00:00
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
2002-10-12 11:37:38 +00:00
|
|
|
*/
|
2004-03-22 22:02:18 +00:00
|
|
|
#ifdef WIN32
|
2002-10-12 11:37:38 +00:00
|
|
|
#pragma warning (disable : 4786)
|
2004-03-22 22:02:18 +00:00
|
|
|
#endif
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-03-25 10:33:39 +00:00
|
|
|
#include "MT_assert.h"
|
|
|
|
|
2002-10-18 14:36:34 +00:00
|
|
|
// defines USE_ODE to choose physics engine
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "KX_ConvertPhysicsObject.h"
|
|
|
|
#include "KX_GameObject.h"
|
|
|
|
#include "RAS_MeshObject.h"
|
|
|
|
#include "KX_Scene.h"
|
|
|
|
#include "SYS_System.h"
|
|
|
|
|
|
|
|
#include "PHY_Pro.h" //todo cleanup
|
|
|
|
#include "KX_ClientObjectInfo.h"
|
|
|
|
|
|
|
|
#include "GEN_Map.h"
|
|
|
|
#include "GEN_HashedPtr.h"
|
|
|
|
|
|
|
|
#include "KX_PhysicsEngineEnums.h"
|
|
|
|
#include "PHY_Pro.h"
|
|
|
|
|
|
|
|
#include "KX_MotionState.h" // bridge between motionstate and scenegraph node
|
2002-11-25 15:29:57 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
#ifdef USE_ODE
|
|
|
|
|
|
|
|
#include "KX_OdePhysicsController.h"
|
2002-10-18 14:36:34 +00:00
|
|
|
#include "OdePhysicsEnvironment.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#endif //USE_ODE
|
|
|
|
|
|
|
|
|
2002-10-18 14:36:34 +00:00
|
|
|
// USE_SUMO_SOLID is defined in headerfile KX_ConvertPhysicsObject.h
|
2002-10-12 11:37:38 +00:00
|
|
|
#ifdef USE_SUMO_SOLID
|
|
|
|
|
2005-07-16 21:47:54 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "SumoPhysicsEnvironment.h"
|
|
|
|
#include "KX_SumoPhysicsController.h"
|
|
|
|
|
|
|
|
|
|
|
|
// sumo physics specific
|
|
|
|
#include "SM_Object.h"
|
|
|
|
#include "SM_FhObject.h"
|
|
|
|
#include "SM_Scene.h"
|
|
|
|
#include "SM_ClientObjectInfo.h"
|
|
|
|
|
|
|
|
#include "KX_SumoPhysicsController.h"
|
|
|
|
|
2004-11-22 11:49:35 +00:00
|
|
|
struct KX_PhysicsInstance
|
|
|
|
{
|
|
|
|
DT_VertexBaseHandle m_vertexbase;
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
RAS_DisplayArray* m_darray;
|
2004-11-22 11:49:35 +00:00
|
|
|
RAS_IPolyMaterial* m_material;
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
|
|
|
|
KX_PhysicsInstance(DT_VertexBaseHandle vertex_base, RAS_DisplayArray *darray, RAS_IPolyMaterial* mat)
|
2004-11-22 11:49:35 +00:00
|
|
|
: m_vertexbase(vertex_base),
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
m_darray(darray),
|
|
|
|
m_material(mat)
|
2004-11-22 11:49:35 +00:00
|
|
|
{
|
|
|
|
}
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
|
2004-11-22 11:49:35 +00:00
|
|
|
~KX_PhysicsInstance()
|
|
|
|
{
|
|
|
|
DT_DeleteVertexBase(m_vertexbase);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2004-05-08 00:25:20 +00:00
|
|
|
static GEN_Map<GEN_HashedPtr,DT_ShapeHandle> map_gamemesh_to_sumoshape;
|
2004-11-22 11:49:35 +00:00
|
|
|
static GEN_Map<GEN_HashedPtr, KX_PhysicsInstance*> map_gamemesh_to_instance;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
// forward declarations
|
2004-11-22 10:19:19 +00:00
|
|
|
static void BL_RegisterSumoObject(KX_GameObject* gameobj,class SM_Scene* sumoScene,class SM_Object* sumoObj,const STR_String& matname,bool isDynamic,bool isActor);
|
|
|
|
static DT_ShapeHandle CreateShapeFromMesh(RAS_MeshObject* meshobj, bool polytope);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2004-03-22 22:02:18 +00:00
|
|
|
void KX_ConvertSumoObject( KX_GameObject* gameobj,
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
RAS_MeshObject* meshobj,
|
|
|
|
KX_Scene* kxscene,
|
|
|
|
PHY_ShapeProps* kxshapeprops,
|
|
|
|
PHY_MaterialProps* kxmaterial,
|
|
|
|
struct KX_ObjectProperties* objprop)
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
SM_ShapeProps* smprop = new SM_ShapeProps;
|
|
|
|
|
|
|
|
smprop->m_ang_drag = kxshapeprops->m_ang_drag;
|
|
|
|
smprop->m_do_anisotropic = kxshapeprops->m_do_anisotropic;
|
|
|
|
smprop->m_do_fh = kxshapeprops->m_do_fh;
|
|
|
|
smprop->m_do_rot_fh = kxshapeprops->m_do_rot_fh ;
|
|
|
|
smprop->m_friction_scaling[0] = kxshapeprops->m_friction_scaling[0];
|
|
|
|
smprop->m_friction_scaling[1] = kxshapeprops->m_friction_scaling[1];
|
|
|
|
smprop->m_friction_scaling[2] = kxshapeprops->m_friction_scaling[2];
|
2004-04-14 05:57:24 +00:00
|
|
|
smprop->m_inertia = MT_Vector3(1., 1., 1.) * kxshapeprops->m_inertia;
|
2002-10-12 11:37:38 +00:00
|
|
|
smprop->m_lin_drag = kxshapeprops->m_lin_drag;
|
|
|
|
smprop->m_mass = kxshapeprops->m_mass;
|
2004-03-22 22:02:18 +00:00
|
|
|
smprop->m_radius = objprop->m_radius;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
SM_MaterialProps* smmaterial = new SM_MaterialProps;
|
|
|
|
|
|
|
|
smmaterial->m_fh_damping = kxmaterial->m_fh_damping;
|
|
|
|
smmaterial->m_fh_distance = kxmaterial->m_fh_distance;
|
|
|
|
smmaterial->m_fh_normal = kxmaterial->m_fh_normal;
|
|
|
|
smmaterial->m_fh_spring = kxmaterial->m_fh_spring;
|
|
|
|
smmaterial->m_friction = kxmaterial->m_friction;
|
2005-08-02 14:59:49 +00:00
|
|
|
smmaterial->m_restitution = kxmaterial->m_restitution;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2004-03-22 22:02:18 +00:00
|
|
|
SumoPhysicsEnvironment* sumoEnv =
|
2002-10-12 11:37:38 +00:00
|
|
|
(SumoPhysicsEnvironment*)kxscene->GetPhysicsEnvironment();
|
|
|
|
|
|
|
|
SM_Scene* sceneptr = sumoEnv->GetSumoScene();
|
|
|
|
|
|
|
|
SM_Object* sumoObj=NULL;
|
|
|
|
|
2004-04-28 09:08:42 +00:00
|
|
|
if (objprop->m_dyna && objprop->m_isactor)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2004-03-22 22:02:18 +00:00
|
|
|
DT_ShapeHandle shape = NULL;
|
2004-11-22 10:19:19 +00:00
|
|
|
bool polytope = false;
|
2004-03-22 22:02:18 +00:00
|
|
|
switch (objprop->m_boundclass)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2004-03-22 22:02:18 +00:00
|
|
|
case KX_BOUNDBOX:
|
2004-04-16 06:26:33 +00:00
|
|
|
shape = DT_NewBox(objprop->m_boundobject.box.m_extends[0],
|
|
|
|
objprop->m_boundobject.box.m_extends[1],
|
|
|
|
objprop->m_boundobject.box.m_extends[2]);
|
|
|
|
smprop->m_inertia.scale(objprop->m_boundobject.box.m_extends[0]*objprop->m_boundobject.box.m_extends[0],
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
objprop->m_boundobject.box.m_extends[1]*objprop->m_boundobject.box.m_extends[1],
|
|
|
|
objprop->m_boundobject.box.m_extends[2]*objprop->m_boundobject.box.m_extends[2]);
|
2004-04-16 06:26:33 +00:00
|
|
|
smprop->m_inertia *= smprop->m_mass/MT_Vector3(objprop->m_boundobject.box.m_extends).length();
|
2004-03-22 22:02:18 +00:00
|
|
|
break;
|
|
|
|
case KX_BOUNDCYLINDER:
|
2004-04-16 06:26:33 +00:00
|
|
|
shape = DT_NewCylinder(smprop->m_radius, objprop->m_boundobject.c.m_height);
|
|
|
|
smprop->m_inertia.scale(smprop->m_mass*smprop->m_radius*smprop->m_radius,
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
smprop->m_mass*smprop->m_radius*smprop->m_radius,
|
|
|
|
smprop->m_mass*objprop->m_boundobject.c.m_height*objprop->m_boundobject.c.m_height);
|
2004-03-22 22:02:18 +00:00
|
|
|
break;
|
|
|
|
case KX_BOUNDCONE:
|
|
|
|
shape = DT_NewCone(objprop->m_radius, objprop->m_boundobject.c.m_height);
|
2004-04-16 06:26:33 +00:00
|
|
|
smprop->m_inertia.scale(smprop->m_mass*smprop->m_radius*smprop->m_radius,
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
smprop->m_mass*smprop->m_radius*smprop->m_radius,
|
|
|
|
smprop->m_mass*objprop->m_boundobject.c.m_height*objprop->m_boundobject.c.m_height);
|
2004-03-22 22:02:18 +00:00
|
|
|
break;
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
/* Dynamic mesh objects. WARNING! slow. */
|
2004-11-22 10:19:19 +00:00
|
|
|
case KX_BOUNDPOLYTOPE:
|
|
|
|
polytope = true;
|
|
|
|
// fall through
|
2004-03-22 22:02:18 +00:00
|
|
|
case KX_BOUNDMESH:
|
|
|
|
if (meshobj && meshobj->NumPolygons() > 0)
|
|
|
|
{
|
2004-11-22 10:19:19 +00:00
|
|
|
if ((shape = CreateShapeFromMesh(meshobj, polytope)))
|
2004-04-16 06:26:33 +00:00
|
|
|
{
|
|
|
|
// TODO: calculate proper inertia
|
|
|
|
smprop->m_inertia *= smprop->m_mass*smprop->m_radius*smprop->m_radius;
|
2004-03-22 22:02:18 +00:00
|
|
|
break;
|
2004-04-16 06:26:33 +00:00
|
|
|
}
|
2004-03-22 22:02:18 +00:00
|
|
|
}
|
|
|
|
/* If CreateShapeFromMesh fails, fall through and use sphere */
|
|
|
|
default:
|
|
|
|
case KX_BOUNDSPHERE:
|
|
|
|
shape = DT_NewSphere(objprop->m_radius);
|
2004-04-16 06:26:33 +00:00
|
|
|
smprop->m_inertia *= smprop->m_mass*smprop->m_radius*smprop->m_radius;
|
2004-03-22 22:02:18 +00:00
|
|
|
break;
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
|
2004-03-22 22:02:18 +00:00
|
|
|
sumoObj = new SM_Object(shape, !objprop->m_ghost?smmaterial:NULL,smprop,NULL);
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
|
2004-03-22 22:02:18 +00:00
|
|
|
sumoObj->setRigidBody(objprop->m_angular_rigidbody?true:false);
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
|
2004-04-14 05:57:24 +00:00
|
|
|
BL_RegisterSumoObject(gameobj,sceneptr,sumoObj,"",true, true);
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
// non physics object
|
|
|
|
if (meshobj)
|
|
|
|
{
|
|
|
|
int numpolys = meshobj->NumPolygons();
|
|
|
|
{
|
|
|
|
|
|
|
|
DT_ShapeHandle complexshape=0;
|
2004-11-22 10:19:19 +00:00
|
|
|
bool polytope = false;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2004-03-22 22:02:18 +00:00
|
|
|
switch (objprop->m_boundclass)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2004-03-22 22:02:18 +00:00
|
|
|
case KX_BOUNDBOX:
|
|
|
|
complexshape = DT_NewBox(objprop->m_boundobject.box.m_extends[0], objprop->m_boundobject.box.m_extends[1], objprop->m_boundobject.box.m_extends[2]);
|
|
|
|
break;
|
|
|
|
case KX_BOUNDSPHERE:
|
|
|
|
complexshape = DT_NewSphere(objprop->m_boundobject.c.m_radius);
|
|
|
|
break;
|
|
|
|
case KX_BOUNDCYLINDER:
|
|
|
|
complexshape = DT_NewCylinder(objprop->m_boundobject.c.m_radius, objprop->m_boundobject.c.m_height);
|
|
|
|
break;
|
|
|
|
case KX_BOUNDCONE:
|
|
|
|
complexshape = DT_NewCone(objprop->m_boundobject.c.m_radius, objprop->m_boundobject.c.m_height);
|
|
|
|
break;
|
2004-11-22 10:19:19 +00:00
|
|
|
case KX_BOUNDPOLYTOPE:
|
|
|
|
polytope = true;
|
|
|
|
// fall through
|
2004-03-22 22:02:18 +00:00
|
|
|
default:
|
|
|
|
case KX_BOUNDMESH:
|
|
|
|
if (numpolys>0)
|
|
|
|
{
|
2004-11-22 10:19:19 +00:00
|
|
|
complexshape = CreateShapeFromMesh(meshobj, polytope);
|
2004-03-22 22:02:18 +00:00
|
|
|
//std::cout << "Convert Physics Mesh: " << meshobj->GetName() << std::endl;
|
|
|
|
/* if (!complexshape)
|
|
|
|
{
|
|
|
|
// Something has to be done here - if the object has no polygons, it will not be able to have
|
|
|
|
// sensors attached to it.
|
|
|
|
DT_Vector3 pt = {0., 0., 0.};
|
|
|
|
complexshape = DT_NewSphere(1.0);
|
|
|
|
objprop->m_ghost = evilObject = true;
|
|
|
|
} */
|
|
|
|
}
|
|
|
|
break;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (complexshape)
|
|
|
|
{
|
|
|
|
SM_Object *dynamicParent = NULL;
|
|
|
|
|
|
|
|
if (objprop->m_dynamic_parent)
|
|
|
|
{
|
|
|
|
// problem is how to find the dynamic parent
|
|
|
|
// in the scenegraph
|
|
|
|
KX_SumoPhysicsController* sumoctrl =
|
|
|
|
(KX_SumoPhysicsController*)
|
|
|
|
objprop->m_dynamic_parent->GetPhysicsController();
|
|
|
|
|
|
|
|
if (sumoctrl)
|
|
|
|
{
|
|
|
|
dynamicParent = sumoctrl->GetSumoObject();
|
|
|
|
}
|
|
|
|
|
2005-03-25 10:33:39 +00:00
|
|
|
MT_assert(dynamicParent);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-03-22 22:02:18 +00:00
|
|
|
sumoObj = new SM_Object(complexshape,!objprop->m_ghost?smmaterial:NULL,NULL, dynamicParent);
|
2002-10-12 11:37:38 +00:00
|
|
|
const STR_String& matname=meshobj->GetMaterialName(0);
|
|
|
|
|
|
|
|
|
|
|
|
BL_RegisterSumoObject(gameobj,sceneptr,
|
2004-04-14 05:57:24 +00:00
|
|
|
sumoObj,
|
2004-04-11 02:50:02 +00:00
|
|
|
matname,
|
2002-10-12 11:37:38 +00:00
|
|
|
objprop->m_dyna,
|
|
|
|
objprop->m_isactor);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// physics object get updated here !
|
|
|
|
|
|
|
|
|
2002-10-18 14:36:34 +00:00
|
|
|
// lazy evaluation because we might not support scaling !gameobj->UpdateTransform();
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
if (objprop->m_in_active_layer && sumoObj)
|
|
|
|
{
|
|
|
|
sceneptr->add(*sumoObj);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2004-11-22 10:19:19 +00:00
|
|
|
static void BL_RegisterSumoObject(
|
2004-04-11 02:50:02 +00:00
|
|
|
KX_GameObject* gameobj,
|
|
|
|
class SM_Scene* sumoScene,
|
|
|
|
class SM_Object* sumoObj,
|
|
|
|
const STR_String& matname,
|
|
|
|
bool isDynamic,
|
|
|
|
bool isActor)
|
|
|
|
{
|
2002-10-12 11:37:38 +00:00
|
|
|
PHY_IMotionState* motionstate = new KX_MotionState(gameobj->GetSGNode());
|
|
|
|
|
|
|
|
// need easy access, not via 'node' etc.
|
2004-04-14 05:57:24 +00:00
|
|
|
KX_SumoPhysicsController* physicscontroller = new KX_SumoPhysicsController(sumoScene,sumoObj,motionstate,isDynamic);
|
2005-08-22 18:31:19 +00:00
|
|
|
gameobj->SetPhysicsController(physicscontroller,isDynamic);
|
2005-03-25 10:33:39 +00:00
|
|
|
|
2004-03-22 22:02:18 +00:00
|
|
|
|
|
|
|
if (!gameobj->getClientInfo())
|
|
|
|
std::cout << "BL_RegisterSumoObject: WARNING: Object " << gameobj->GetName() << " has no client info" << std::endl;
|
2005-03-25 10:33:39 +00:00
|
|
|
physicscontroller->setNewClientInfo(gameobj->getClientInfo());
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
gameobj->GetSGNode()->AddSGController(physicscontroller);
|
|
|
|
|
2004-03-22 22:02:18 +00:00
|
|
|
gameobj->getClientInfo()->m_type = (isActor ? KX_ClientObjectInfo::ACTOR : KX_ClientObjectInfo::STATIC);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
// store materialname in auxinfo, needed for touchsensors
|
2004-04-11 02:50:02 +00:00
|
|
|
gameobj->getClientInfo()->m_auxilary_info = (matname.Length() ? (void*)(matname.ReadPtr()+2) : NULL);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
physicscontroller->SetObject(gameobj->GetSGNode());
|
2004-04-14 05:57:24 +00:00
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
static DT_ShapeHandle InstancePhysicsComplex(RAS_MeshObject* meshobj, RAS_DisplayArray *darray, RAS_IPolyMaterial *mat)
|
2004-11-22 10:19:19 +00:00
|
|
|
{
|
|
|
|
// instance a mesh from a single vertex array & material
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
const RAS_TexVert *vertex_array = &darray->m_vertex[0];
|
|
|
|
DT_VertexBaseHandle vertex_base = DT_NewVertexBase(vertex_array[0].getXYZ(), sizeof(RAS_TexVert));
|
2004-11-22 10:19:19 +00:00
|
|
|
|
|
|
|
DT_ShapeHandle shape = DT_NewComplexShape(vertex_base);
|
|
|
|
|
|
|
|
std::vector<DT_Index> indices;
|
|
|
|
for (int p = 0; p < meshobj->NumPolygons(); p++)
|
|
|
|
{
|
|
|
|
RAS_Polygon* poly = meshobj->GetPolygon(p);
|
|
|
|
|
|
|
|
// only add polygons that have the collisionflag set
|
|
|
|
if (poly->IsCollider())
|
|
|
|
{
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
DT_Begin();
|
|
|
|
DT_VertexIndex(poly->GetVertexOffset(0));
|
|
|
|
DT_VertexIndex(poly->GetVertexOffset(1));
|
|
|
|
DT_VertexIndex(poly->GetVertexOffset(2));
|
|
|
|
DT_End();
|
2004-11-22 10:19:19 +00:00
|
|
|
|
|
|
|
// tesselate
|
|
|
|
if (poly->VertexCount() == 4)
|
|
|
|
{
|
|
|
|
DT_Begin();
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
DT_VertexIndex(poly->GetVertexOffset(0));
|
|
|
|
DT_VertexIndex(poly->GetVertexOffset(2));
|
|
|
|
DT_VertexIndex(poly->GetVertexOffset(3));
|
2004-11-22 10:19:19 +00:00
|
|
|
DT_End();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//DT_VertexIndices(indices.size(), &indices[0]);
|
|
|
|
DT_EndComplexShape();
|
|
|
|
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
map_gamemesh_to_instance.insert(GEN_HashedPtr(meshobj), new KX_PhysicsInstance(vertex_base, darray, mat));
|
2004-11-22 10:19:19 +00:00
|
|
|
return shape;
|
|
|
|
}
|
|
|
|
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
static DT_ShapeHandle InstancePhysicsPolytope(RAS_MeshObject* meshobj, RAS_DisplayArray *darray, RAS_IPolyMaterial *mat)
|
2004-11-22 10:19:19 +00:00
|
|
|
{
|
|
|
|
// instance a mesh from a single vertex array & material
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
const RAS_TexVert *vertex_array = &darray->m_vertex[0];
|
|
|
|
DT_VertexBaseHandle vertex_base = DT_NewVertexBase(vertex_array[0].getXYZ(), sizeof(RAS_TexVert));
|
2004-11-22 10:19:19 +00:00
|
|
|
|
|
|
|
std::vector<DT_Index> indices;
|
|
|
|
for (int p = 0; p < meshobj->NumPolygons(); p++)
|
|
|
|
{
|
|
|
|
RAS_Polygon* poly = meshobj->GetPolygon(p);
|
|
|
|
|
|
|
|
// only add polygons that have the collisionflag set
|
|
|
|
if (poly->IsCollider())
|
|
|
|
{
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
indices.push_back(poly->GetVertexOffset(0));
|
|
|
|
indices.push_back(poly->GetVertexOffset(1));
|
|
|
|
indices.push_back(poly->GetVertexOffset(2));
|
2004-11-22 10:19:19 +00:00
|
|
|
|
|
|
|
if (poly->VertexCount() == 4)
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
indices.push_back(poly->GetVertexOffset(3));
|
2004-11-22 10:19:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
DT_ShapeHandle shape = DT_NewPolytope(vertex_base);
|
|
|
|
DT_VertexIndices(indices.size(), &indices[0]);
|
|
|
|
DT_EndPolytope();
|
|
|
|
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
map_gamemesh_to_instance.insert(GEN_HashedPtr(meshobj), new KX_PhysicsInstance(vertex_base, darray, mat));
|
2004-11-22 10:19:19 +00:00
|
|
|
return shape;
|
|
|
|
}
|
|
|
|
|
|
|
|
// This will have to be a method in a class somewhere...
|
|
|
|
// Update SOLID with a changed physics mesh.
|
|
|
|
// not used... yet.
|
2004-11-22 11:49:35 +00:00
|
|
|
bool KX_ReInstanceShapeFromMesh(RAS_MeshObject* meshobj)
|
2004-11-22 10:19:19 +00:00
|
|
|
{
|
2004-11-22 11:49:35 +00:00
|
|
|
KX_PhysicsInstance *instance = *map_gamemesh_to_instance[GEN_HashedPtr(meshobj)];
|
|
|
|
if (instance)
|
2004-11-22 10:19:19 +00:00
|
|
|
{
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
const RAS_TexVert *vertex_array = &instance->m_darray->m_vertex[0];
|
|
|
|
DT_ChangeVertexBase(instance->m_vertexbase, vertex_array[0].getXYZ());
|
2004-11-22 10:19:19 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
static DT_ShapeHandle CreateShapeFromMesh(RAS_MeshObject* meshobj, bool polytope)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
|
|
|
|
2004-03-22 22:02:18 +00:00
|
|
|
DT_ShapeHandle *shapeptr = map_gamemesh_to_sumoshape[GEN_HashedPtr(meshobj)];
|
2004-11-22 10:19:19 +00:00
|
|
|
// Mesh has already been converted: reuse
|
2002-10-12 11:37:38 +00:00
|
|
|
if (shapeptr)
|
|
|
|
{
|
|
|
|
return *shapeptr;
|
|
|
|
}
|
|
|
|
|
2004-11-22 10:19:19 +00:00
|
|
|
// Mesh has no polygons!
|
2002-10-12 11:37:38 +00:00
|
|
|
int numpolys = meshobj->NumPolygons();
|
|
|
|
if (!numpolys)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
2004-11-22 10:19:19 +00:00
|
|
|
|
|
|
|
// Count the number of collision polygons and check they all come from the same
|
|
|
|
// vertex array
|
2002-10-12 11:37:38 +00:00
|
|
|
int numvalidpolys = 0;
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
RAS_DisplayArray *darray = NULL;
|
2004-11-22 10:19:19 +00:00
|
|
|
RAS_IPolyMaterial *poly_material = NULL;
|
|
|
|
bool reinstance = true;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2004-03-22 22:02:18 +00:00
|
|
|
for (int p=0; p<numpolys; p++)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2004-03-22 22:02:18 +00:00
|
|
|
RAS_Polygon* poly = meshobj->GetPolygon(p);
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
// only add polygons that have the collisionflag set
|
2004-03-22 22:02:18 +00:00
|
|
|
if (poly->IsCollider())
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2004-11-22 10:19:19 +00:00
|
|
|
// check polygon is from the same vertex array
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
if (poly->GetDisplayArray() != darray)
|
2004-11-22 10:19:19 +00:00
|
|
|
{
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
if (darray == NULL)
|
|
|
|
darray = poly->GetDisplayArray();
|
2004-11-22 10:19:19 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
reinstance = false;
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
darray = NULL;
|
2004-11-22 10:19:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 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
|
2004-03-22 22:02:18 +00:00
|
|
|
numvalidpolys++;
|
2004-11-22 10:19:19 +00:00
|
|
|
|
|
|
|
// We have one collision poly, and we can't reinstance, so we
|
|
|
|
// might as well break here.
|
|
|
|
if (!reinstance)
|
|
|
|
break;
|
2004-03-22 22:02:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-11-22 10:19:19 +00:00
|
|
|
// No collision polygons
|
2004-03-22 22:02:18 +00:00
|
|
|
if (numvalidpolys < 1)
|
|
|
|
return NULL;
|
|
|
|
|
2004-11-22 10:19:19 +00:00
|
|
|
DT_ShapeHandle shape;
|
|
|
|
if (reinstance)
|
2004-03-22 22:02:18 +00:00
|
|
|
{
|
2004-11-22 10:19:19 +00:00
|
|
|
if (polytope)
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
shape = InstancePhysicsPolytope(meshobj, darray, poly_material);
|
2004-11-22 10:19:19 +00:00
|
|
|
else
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
shape = InstancePhysicsComplex(meshobj, darray, poly_material);
|
2004-11-22 10:19:19 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (polytope)
|
|
|
|
{
|
|
|
|
std::cout << "CreateShapeFromMesh: " << meshobj->GetName() << " is not suitable for polytope." << std::endl;
|
|
|
|
if (!poly_material)
|
|
|
|
std::cout << " Check mesh materials." << std::endl;
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
if (darray == NULL)
|
2004-11-22 10:19:19 +00:00
|
|
|
std::cout << " Check number of vertices." << std::endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
shape = DT_NewComplexShape(NULL);
|
2004-03-22 22:02:18 +00:00
|
|
|
|
2004-11-22 10:19:19 +00:00
|
|
|
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())
|
|
|
|
{ /* We have to tesselate here because SOLID can only raycast triangles */
|
|
|
|
DT_Begin();
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
/* V1, V2, V3 */
|
|
|
|
DT_Vertex(poly->GetVertex(2)->getXYZ());
|
|
|
|
DT_Vertex(poly->GetVertex(1)->getXYZ());
|
|
|
|
DT_Vertex(poly->GetVertex(0)->getXYZ());
|
2004-11-22 10:19:19 +00:00
|
|
|
|
2004-03-22 22:02:18 +00:00
|
|
|
numvalidpolys++;
|
2004-11-22 10:19:19 +00:00
|
|
|
DT_End();
|
|
|
|
|
|
|
|
if (poly->VertexCount() == 4)
|
|
|
|
{
|
|
|
|
DT_Begin();
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
/* V1, V3, V4 */
|
|
|
|
DT_Vertex(poly->GetVertex(3)->getXYZ());
|
|
|
|
DT_Vertex(poly->GetVertex(2)->getXYZ());
|
|
|
|
DT_Vertex(poly->GetVertex(0)->getXYZ());
|
2004-11-22 10:19:19 +00:00
|
|
|
|
|
|
|
numvalidpolys++;
|
|
|
|
DT_End();
|
|
|
|
}
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
}
|
2004-11-22 10:19:19 +00:00
|
|
|
|
|
|
|
DT_EndComplexShape();
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (numvalidpolys > 0)
|
|
|
|
{
|
|
|
|
map_gamemesh_to_sumoshape.insert(GEN_HashedPtr(meshobj),shape);
|
|
|
|
return shape;
|
|
|
|
}
|
|
|
|
|
2004-03-22 22:02:18 +00:00
|
|
|
delete shape;
|
2002-10-12 11:37:38 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void KX_ClearSumoSharedShapes()
|
|
|
|
{
|
|
|
|
int numshapes = map_gamemesh_to_sumoshape.size();
|
2004-11-22 10:19:19 +00:00
|
|
|
int i;
|
|
|
|
for (i=0;i<numshapes ;i++)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
|
|
|
DT_ShapeHandle shape = *map_gamemesh_to_sumoshape.at(i);
|
|
|
|
DT_DeleteShape(shape);
|
|
|
|
}
|
|
|
|
|
|
|
|
map_gamemesh_to_sumoshape.clear();
|
2004-11-22 10:19:19 +00:00
|
|
|
|
2004-11-22 11:49:35 +00:00
|
|
|
for (i=0; i < map_gamemesh_to_instance.size(); i++)
|
|
|
|
delete *map_gamemesh_to_instance.at(i);
|
2004-11-22 10:19:19 +00:00
|
|
|
|
2004-11-22 11:49:35 +00:00
|
|
|
map_gamemesh_to_instance.clear();
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
2005-07-16 21:47:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
#endif //USE_SUMO_SOLID
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef USE_ODE
|
|
|
|
|
|
|
|
void KX_ConvertODEEngineObject(KX_GameObject* gameobj,
|
|
|
|
RAS_MeshObject* meshobj,
|
|
|
|
KX_Scene* kxscene,
|
|
|
|
struct PHY_ShapeProps* shapeprops,
|
|
|
|
struct PHY_MaterialProps* smmaterial,
|
|
|
|
struct KX_ObjectProperties* objprop)
|
|
|
|
{
|
2005-03-25 10:33:39 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
// not yet, future extension :)
|
|
|
|
bool dyna=objprop->m_dyna;
|
|
|
|
bool fullRigidBody= ( objprop->m_dyna && objprop->m_angular_rigidbody) != 0;
|
|
|
|
bool phantom = objprop->m_ghost;
|
|
|
|
class PHY_IMotionState* motionstate = new KX_MotionState(gameobj->GetSGNode());
|
|
|
|
|
|
|
|
class ODEPhysicsEnvironment* odeEnv =
|
|
|
|
(ODEPhysicsEnvironment*)kxscene->GetPhysicsEnvironment();
|
|
|
|
|
|
|
|
dxSpace* space = odeEnv->GetOdeSpace();
|
|
|
|
dxWorld* world = odeEnv->GetOdeWorld();
|
|
|
|
|
2005-03-25 10:33:39 +00:00
|
|
|
bool isSphere = false;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-03-25 10:33:39 +00:00
|
|
|
switch (objprop->m_boundclass)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2005-03-25 10:33:39 +00:00
|
|
|
case KX_BOUNDBOX:
|
|
|
|
{
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-03-25 10:33:39 +00:00
|
|
|
KX_OdePhysicsController* physicscontroller =
|
|
|
|
new KX_OdePhysicsController(
|
|
|
|
dyna,
|
|
|
|
fullRigidBody,
|
|
|
|
phantom,
|
|
|
|
motionstate,
|
|
|
|
space,
|
|
|
|
world,
|
|
|
|
shapeprops->m_mass,
|
|
|
|
smmaterial->m_friction,
|
|
|
|
smmaterial->m_restitution,
|
|
|
|
isSphere,
|
|
|
|
objprop->m_boundobject.box.m_center,
|
|
|
|
objprop->m_boundobject.box.m_extends,
|
|
|
|
objprop->m_boundobject.c.m_radius
|
|
|
|
);
|
|
|
|
|
|
|
|
gameobj->SetPhysicsController(physicscontroller);
|
|
|
|
physicscontroller->setNewClientInfo(gameobj->getClientInfo());
|
|
|
|
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());
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-03-25 10:33:39 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
}
|
|
|
|
};
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif // USE_ODE
|
2005-07-16 21:47:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
#ifdef USE_BULLET
|
|
|
|
|
|
|
|
#include "CcdPhysicsEnvironment.h"
|
|
|
|
#include "CcdPhysicsController.h"
|
2006-11-21 00:53:40 +00:00
|
|
|
#include "BulletCollision/BroadphaseCollision/btBroadphaseInterface.h"
|
2005-07-16 21:47:54 +00:00
|
|
|
|
|
|
|
#include "KX_BulletPhysicsController.h"
|
2006-11-21 00:53:40 +00:00
|
|
|
#include "btBulletDynamicsCommon.h"
|
2005-07-16 21:47:54 +00:00
|
|
|
|
2006-04-13 05:11:34 +00:00
|
|
|
#ifdef WIN32
|
|
|
|
#if _MSC_VER >= 1310
|
|
|
|
//only use SIMD Hull code under Win32
|
2006-04-26 03:20:28 +00:00
|
|
|
//#define TEST_HULL 1
|
2006-04-14 03:18:17 +00:00
|
|
|
#ifdef TEST_HULL
|
2006-04-13 05:11:34 +00:00
|
|
|
#define USE_HULL 1
|
2006-04-26 03:20:28 +00:00
|
|
|
//#define TEST_SIMD_HULL 1
|
2006-04-13 05:11:34 +00:00
|
|
|
|
|
|
|
#include "NarrowPhaseCollision/Hull.h"
|
2006-04-14 03:18:17 +00:00
|
|
|
#endif //#ifdef TEST_HULL
|
2006-04-13 05:11:34 +00:00
|
|
|
|
|
|
|
#endif //_MSC_VER
|
|
|
|
#endif //WIN32
|
|
|
|
|
2005-07-16 21:47:54 +00:00
|
|
|
|
|
|
|
// forward declarations
|
|
|
|
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
|
2006-04-28 17:35:03 +00:00
|
|
|
CcdPhysicsEnvironment* env = (CcdPhysicsEnvironment*)kxscene->GetPhysicsEnvironment();
|
2005-07-16 21:47:54 +00:00
|
|
|
assert(env);
|
|
|
|
|
2006-12-01 03:29:20 +00:00
|
|
|
|
|
|
|
bool isbulletdyna = false;
|
2005-07-16 21:47:54 +00:00
|
|
|
CcdConstructionInfo ci;
|
2006-12-01 03:29:20 +00:00
|
|
|
class PHY_IMotionState* motionstate = new KX_MotionState(gameobj->GetSGNode());
|
2008-08-21 15:19:54 +00:00
|
|
|
class CcdShapeConstructionInfo *shapeInfo = new CcdShapeConstructionInfo();
|
2006-12-01 03:29:20 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!objprop->m_dyna)
|
|
|
|
{
|
|
|
|
ci.m_collisionFlags |= btCollisionObject::CF_STATIC_OBJECT;
|
|
|
|
}
|
2008-03-15 20:52:03 +00:00
|
|
|
if (objprop->m_ghost)
|
|
|
|
{
|
|
|
|
ci.m_collisionFlags |= btCollisionObject::CF_NO_CONTACT_RESPONSE;
|
|
|
|
}
|
2006-12-01 03:29:20 +00:00
|
|
|
|
|
|
|
ci.m_MotionState = motionstate;
|
|
|
|
ci.m_gravity = btVector3(0,0,0);
|
2006-11-21 00:53:40 +00:00
|
|
|
ci.m_localInertiaTensor =btVector3(0,0,0);
|
2005-07-16 21:47:54 +00:00
|
|
|
ci.m_mass = objprop->m_dyna ? shapeprops->m_mass : 0.f;
|
BGE patch: new Physics button and margin parameter in Logic panel. Change subversion.
The Physics button controls the creation of a physics representation
of the object when starting the game. If the button is not selected,
the object is a pure graphical object with no physics representation
and all the other physics buttons are hidden.
Selecting this button gives access to the usual physics buttons.
The physics button is enabled by default to match previous Blender
behavior.
The margin parameter allows to control the collision margin from
the UI. Previously, this parameter was only accessible through
Python. By default, the collision margin is set to 0.0 on static
objects and 0.06 on dynamic objects.
To maintain compatibility with older games, the collision margin
is set to 0.06 on all objects when loading older blend file.
Note about the collision algorithms in Bullet 2.71
--------------------------------------------------
Bullet 2.71 handles the collision margin differently than Bullet 2.53
(the previous Bullet version in Blender). The collision margin is
now kept "inside" the object for box, sphere and cylinder bound
shapes. This means that two objects bound to any of these shape will
come in close contact when colliding.
The static mesh, convex hull and cone shapes still have their
collision margin "outside" the object, which leaves a space of 1
or 2 times the collision margin between objects.
The situation with Bullet 2.53 was more complicated, generally
leading to more space between objects, except for box-box collisions.
This means that running a old game under Bullet 2.71 may cause
visual problems, especially if the objects are small. You can fix
these problems by changing some visual aspect of the objects:
center, shape, size, position of children, etc.
2008-09-14 19:34:06 +00:00
|
|
|
ci.m_margin = objprop->m_margin;
|
2008-08-21 15:19:54 +00:00
|
|
|
shapeInfo->m_radius = objprop->m_radius;
|
2006-12-01 03:29:20 +00:00
|
|
|
isbulletdyna = objprop->m_dyna;
|
|
|
|
|
|
|
|
ci.m_localInertiaTensor = btVector3(ci.m_mass/3.f,ci.m_mass/3.f,ci.m_mass/3.f);
|
|
|
|
|
2006-11-21 00:53:40 +00:00
|
|
|
btCollisionShape* bm = 0;
|
2005-07-16 21:47:54 +00:00
|
|
|
|
|
|
|
switch (objprop->m_boundclass)
|
|
|
|
{
|
|
|
|
case KX_BOUNDSPHERE:
|
|
|
|
{
|
2008-08-21 15:19:54 +00:00
|
|
|
//float radius = objprop->m_radius;
|
|
|
|
//btVector3 inertiaHalfExtents (
|
|
|
|
// radius,
|
|
|
|
// radius,
|
|
|
|
// radius);
|
2005-07-16 21:47:54 +00:00
|
|
|
|
|
|
|
//blender doesn't support multisphere, but for testing:
|
|
|
|
|
|
|
|
//bm = new MultiSphereShape(inertiaHalfExtents,,&trans.getOrigin(),&radius,1);
|
2008-08-21 15:19:54 +00:00
|
|
|
shapeInfo->m_shapeType = PHY_SHAPE_SPHERE;
|
|
|
|
bm = shapeInfo->CreateBulletShape();
|
2005-07-16 21:47:54 +00:00
|
|
|
break;
|
|
|
|
};
|
|
|
|
case KX_BOUNDBOX:
|
|
|
|
{
|
2008-08-21 15:19:54 +00:00
|
|
|
shapeInfo->m_halfExtend.setValue(
|
2005-07-16 21:47:54 +00:00
|
|
|
objprop->m_boundobject.box.m_extends[0],
|
2008-08-21 15:19:54 +00:00
|
|
|
objprop->m_boundobject.box.m_extends[1],
|
|
|
|
objprop->m_boundobject.box.m_extends[2]);
|
2005-07-16 21:47:54 +00:00
|
|
|
|
2008-08-21 15:19:54 +00:00
|
|
|
shapeInfo->m_halfExtend /= 2.0;
|
|
|
|
shapeInfo->m_halfExtend = shapeInfo->m_halfExtend.absolute();
|
|
|
|
shapeInfo->m_shapeType = PHY_SHAPE_BOX;
|
|
|
|
bm = shapeInfo->CreateBulletShape();
|
2005-07-16 21:47:54 +00:00
|
|
|
break;
|
|
|
|
};
|
|
|
|
case KX_BOUNDCYLINDER:
|
|
|
|
{
|
2008-08-21 15:19:54 +00:00
|
|
|
shapeInfo->m_halfExtend.setValue(
|
2005-07-16 21:47:54 +00:00
|
|
|
objprop->m_boundobject.c.m_radius,
|
|
|
|
objprop->m_boundobject.c.m_radius,
|
|
|
|
objprop->m_boundobject.c.m_height * 0.5f
|
|
|
|
);
|
2008-08-21 15:19:54 +00:00
|
|
|
shapeInfo->m_shapeType = PHY_SHAPE_CYLINDER;
|
|
|
|
bm = shapeInfo->CreateBulletShape();
|
2005-07-16 21:47:54 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2008-08-21 15:19:54 +00:00
|
|
|
case KX_BOUNDCONE:
|
2005-07-16 21:47:54 +00:00
|
|
|
{
|
2008-08-21 15:19:54 +00:00
|
|
|
shapeInfo->m_radius = objprop->m_boundobject.c.m_radius;
|
|
|
|
shapeInfo->m_height = objprop->m_boundobject.c.m_height;
|
|
|
|
shapeInfo->m_shapeType = PHY_SHAPE_CONE;
|
|
|
|
bm = shapeInfo->CreateBulletShape();
|
2005-07-16 21:47:54 +00:00
|
|
|
break;
|
|
|
|
}
|
2008-08-21 15:19:54 +00:00
|
|
|
case KX_BOUNDPOLYTOPE:
|
2005-07-16 21:47:54 +00:00
|
|
|
{
|
2008-08-21 15:19:54 +00:00
|
|
|
shapeInfo->SetMesh(meshobj, true);
|
|
|
|
bm = shapeInfo->CreateBulletShape();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case KX_BOUNDMESH:
|
|
|
|
{
|
|
|
|
if (!ci.m_mass)
|
|
|
|
{
|
|
|
|
shapeInfo->SetMesh(meshobj, false);
|
|
|
|
bm = shapeInfo->CreateBulletShape();
|
|
|
|
//no moving concave meshes, so don't bother calculating inertia
|
|
|
|
//bm->calculateLocalInertia(ci.m_mass,ci.m_localInertiaTensor);
|
2005-07-16 21:47:54 +00:00
|
|
|
}
|
2008-08-21 15:19:54 +00:00
|
|
|
|
|
|
|
break;
|
2005-07-16 21:47:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ci.m_localInertiaTensor.setValue(0.1f,0.1f,0.1f);
|
|
|
|
|
|
|
|
if (!bm)
|
2008-03-01 19:46:50 +00:00
|
|
|
{
|
|
|
|
delete motionstate;
|
2008-08-21 15:19:54 +00:00
|
|
|
delete shapeInfo;
|
2005-07-16 21:47:54 +00:00
|
|
|
return;
|
2008-03-01 19:46:50 +00:00
|
|
|
}
|
2005-07-16 21:47:54 +00:00
|
|
|
|
BGE patch: new Physics button and margin parameter in Logic panel. Change subversion.
The Physics button controls the creation of a physics representation
of the object when starting the game. If the button is not selected,
the object is a pure graphical object with no physics representation
and all the other physics buttons are hidden.
Selecting this button gives access to the usual physics buttons.
The physics button is enabled by default to match previous Blender
behavior.
The margin parameter allows to control the collision margin from
the UI. Previously, this parameter was only accessible through
Python. By default, the collision margin is set to 0.0 on static
objects and 0.06 on dynamic objects.
To maintain compatibility with older games, the collision margin
is set to 0.06 on all objects when loading older blend file.
Note about the collision algorithms in Bullet 2.71
--------------------------------------------------
Bullet 2.71 handles the collision margin differently than Bullet 2.53
(the previous Bullet version in Blender). The collision margin is
now kept "inside" the object for box, sphere and cylinder bound
shapes. This means that two objects bound to any of these shape will
come in close contact when colliding.
The static mesh, convex hull and cone shapes still have their
collision margin "outside" the object, which leaves a space of 1
or 2 times the collision margin between objects.
The situation with Bullet 2.53 was more complicated, generally
leading to more space between objects, except for box-box collisions.
This means that running a old game under Bullet 2.71 may cause
visual problems, especially if the objects are small. You can fix
these problems by changing some visual aspect of the objects:
center, shape, size, position of children, etc.
2008-09-14 19:34:06 +00:00
|
|
|
bm->setMargin(ci.m_margin);
|
2006-12-01 01:04:27 +00:00
|
|
|
|
2006-12-01 03:29:20 +00:00
|
|
|
|
|
|
|
if (objprop->m_isCompoundChild)
|
2006-12-01 01:04:27 +00:00
|
|
|
{
|
2006-12-01 03:29:20 +00:00
|
|
|
//find parent, compound shape and add to it
|
|
|
|
//take relative transform into account!
|
|
|
|
KX_BulletPhysicsController* parentCtrl = (KX_BulletPhysicsController*)objprop->m_dynamic_parent->GetPhysicsController();
|
|
|
|
assert(parentCtrl);
|
2008-08-21 15:19:54 +00:00
|
|
|
CcdShapeConstructionInfo* parentShapeInfo = parentCtrl->GetShapeInfo();
|
2006-12-01 03:29:20 +00:00
|
|
|
btRigidBody* rigidbody = parentCtrl->GetRigidBody();
|
|
|
|
btCollisionShape* colShape = rigidbody->getCollisionShape();
|
|
|
|
assert(colShape->isCompound());
|
|
|
|
btCompoundShape* compoundShape = (btCompoundShape*)colShape;
|
|
|
|
|
2008-09-13 11:46:07 +00:00
|
|
|
// compute the local transform from parent, this may include a parent inverse node
|
|
|
|
SG_Node* gameNode = gameobj->GetSGNode();
|
|
|
|
SG_Node* parentInverseNode = gameNode->GetSGParent();
|
|
|
|
if (parentInverseNode && parentInverseNode->GetSGClientObject() != NULL)
|
|
|
|
// this is not a parent inverse node, cancel it
|
|
|
|
parentInverseNode = NULL;
|
|
|
|
// now combine the parent inverse node and the game node
|
|
|
|
MT_Point3 childPos = gameNode->GetLocalPosition();
|
|
|
|
MT_Matrix3x3 childRot = gameNode->GetLocalOrientation();
|
|
|
|
MT_Vector3 childScale = gameNode->GetLocalScale();
|
|
|
|
if (parentInverseNode)
|
|
|
|
{
|
|
|
|
const MT_Point3& parentInversePos = parentInverseNode->GetLocalPosition();
|
|
|
|
const MT_Matrix3x3& parentInverseRot = parentInverseNode->GetLocalOrientation();
|
|
|
|
const MT_Vector3& parentInverseScale = parentInverseNode->GetLocalScale();
|
|
|
|
childRot = parentInverseRot * childRot;
|
|
|
|
childScale = parentInverseScale * childScale;
|
|
|
|
childPos = parentInversePos+parentInverseScale*(parentInverseRot*childPos);
|
|
|
|
}
|
2006-12-01 03:29:20 +00:00
|
|
|
|
2008-09-13 11:46:07 +00:00
|
|
|
shapeInfo->m_childScale.setValue(childScale.x(),childScale.y(),childScale.z());
|
|
|
|
bm->setLocalScaling(shapeInfo->m_childScale);
|
|
|
|
|
2008-08-21 15:19:54 +00:00
|
|
|
shapeInfo->m_childTrans.setOrigin(btVector3(childPos.x(),childPos.y(),childPos.z()));
|
2006-12-01 03:29:20 +00:00
|
|
|
float rotval[12];
|
|
|
|
childRot.getValue(rotval);
|
|
|
|
btMatrix3x3 newRot;
|
|
|
|
newRot.setValue(rotval[0],rotval[1],rotval[2],rotval[4],rotval[5],rotval[6],rotval[8],rotval[9],rotval[10]);
|
|
|
|
newRot = newRot.transpose();
|
|
|
|
|
2008-08-21 15:19:54 +00:00
|
|
|
shapeInfo->m_childTrans.setBasis(newRot);
|
|
|
|
parentShapeInfo->AddShape(shapeInfo);
|
|
|
|
|
|
|
|
compoundShape->addChildShape(shapeInfo->m_childTrans,bm);
|
2006-12-01 03:29:20 +00:00
|
|
|
//do some recalc?
|
|
|
|
//recalc inertia for rigidbody
|
|
|
|
if (!rigidbody->isStaticOrKinematicObject())
|
|
|
|
{
|
|
|
|
btVector3 localInertia;
|
|
|
|
float mass = 1.f/rigidbody->getInvMass();
|
|
|
|
compoundShape->calculateLocalInertia(mass,localInertia);
|
|
|
|
rigidbody->setMassProps(mass,localInertia);
|
|
|
|
}
|
|
|
|
return;
|
2006-12-01 01:04:27 +00:00
|
|
|
}
|
|
|
|
|
2006-12-01 03:29:20 +00:00
|
|
|
if (objprop->m_hasCompoundChildren)
|
|
|
|
{
|
2008-08-21 15:19:54 +00:00
|
|
|
// create a compound shape info
|
|
|
|
CcdShapeConstructionInfo *compoundShapeInfo = new CcdShapeConstructionInfo();
|
|
|
|
compoundShapeInfo->m_shapeType = PHY_SHAPE_COMPOUND;
|
|
|
|
compoundShapeInfo->AddShape(shapeInfo);
|
|
|
|
// create the compound shape manually as we already have the child shape
|
2006-12-01 03:29:20 +00:00
|
|
|
btCompoundShape* compoundShape = new btCompoundShape();
|
2008-08-21 15:19:54 +00:00
|
|
|
compoundShape->addChildShape(shapeInfo->m_childTrans,bm);
|
|
|
|
// now replace the shape
|
2006-12-01 03:29:20 +00:00
|
|
|
bm = compoundShape;
|
2008-08-21 15:19:54 +00:00
|
|
|
shapeInfo = compoundShapeInfo;
|
2006-12-01 03:29:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-12-01 01:04:27 +00:00
|
|
|
|
|
|
|
|
2006-04-13 05:11:34 +00:00
|
|
|
#ifdef TEST_SIMD_HULL
|
|
|
|
if (bm->IsPolyhedral())
|
|
|
|
{
|
|
|
|
PolyhedralConvexShape* polyhedron = static_cast<PolyhedralConvexShape*>(bm);
|
|
|
|
if (!polyhedron->m_optionalHull)
|
|
|
|
{
|
|
|
|
//first convert vertices in 'Point3' format
|
|
|
|
int numPoints = polyhedron->GetNumVertices();
|
|
|
|
Point3* points = new Point3[numPoints+1];
|
|
|
|
//first 4 points should not be co-planar, so add central point to satisfy MakeHull
|
|
|
|
points[0] = Point3(0.f,0.f,0.f);
|
|
|
|
|
2006-11-21 00:53:40 +00:00
|
|
|
btVector3 vertex;
|
2006-04-13 05:11:34 +00:00
|
|
|
for (int p=0;p<numPoints;p++)
|
|
|
|
{
|
|
|
|
polyhedron->GetVertex(p,vertex);
|
|
|
|
points[p+1] = Point3(vertex.getX(),vertex.getY(),vertex.getZ());
|
|
|
|
}
|
|
|
|
|
|
|
|
Hull* hull = Hull::MakeHull(numPoints+1,points);
|
|
|
|
polyhedron->m_optionalHull = hull;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
#endif //TEST_SIMD_HULL
|
|
|
|
|
|
|
|
|
2005-07-16 21:47:54 +00:00
|
|
|
ci.m_collisionShape = bm;
|
2008-08-21 15:19:54 +00:00
|
|
|
ci.m_shapeInfo = shapeInfo;
|
2006-02-21 05:36:56 +00:00
|
|
|
ci.m_friction = smmaterial->m_friction;//tweak the friction a bit, so the default 0.5 works nice
|
2005-07-16 21:47:54 +00:00
|
|
|
ci.m_restitution = smmaterial->m_restitution;
|
2005-12-31 07:20:08 +00:00
|
|
|
ci.m_physicsEnv = env;
|
2005-08-05 17:00:32 +00:00
|
|
|
// 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
|
2005-12-31 21:59:56 +00:00
|
|
|
ci.m_inertiaFactor = shapeprops->m_inertia/0.4f;//defaults to 0.4, don't want to change behaviour
|
2008-03-01 19:17:37 +00:00
|
|
|
ci.m_collisionFilterGroup = (isbulletdyna) ? short(CcdConstructionInfo::DefaultFilter) : short(CcdConstructionInfo::StaticFilter);
|
|
|
|
ci.m_collisionFilterMask = (isbulletdyna) ? short(CcdConstructionInfo::AllFilter) : short(CcdConstructionInfo::AllFilter ^ CcdConstructionInfo::StaticFilter);
|
2008-05-01 16:00:59 +00:00
|
|
|
ci.m_bRigid = objprop->m_dyna && objprop->m_angular_rigidbody;
|
2008-08-21 21:04:42 +00:00
|
|
|
MT_Vector3 scaling = gameobj->NodeGetWorldScaling();
|
|
|
|
ci.m_scaling.setValue(scaling[0], scaling[1], scaling[2]);
|
2005-08-23 13:16:02 +00:00
|
|
|
KX_BulletPhysicsController* physicscontroller = new KX_BulletPhysicsController(ci,isbulletdyna);
|
2008-08-21 15:19:54 +00:00
|
|
|
// shapeInfo is reference counted, decrement now as we don't use it anymore
|
|
|
|
if (shapeInfo)
|
|
|
|
shapeInfo->Release();
|
2005-12-31 07:20:08 +00:00
|
|
|
|
|
|
|
if (objprop->m_in_active_layer)
|
|
|
|
{
|
|
|
|
env->addCcdPhysicsController( physicscontroller);
|
|
|
|
}
|
2005-07-16 21:47:54 +00:00
|
|
|
|
|
|
|
|
2006-02-21 05:36:56 +00:00
|
|
|
|
2005-08-23 13:16:02 +00:00
|
|
|
gameobj->SetPhysicsController(physicscontroller,isbulletdyna);
|
2005-08-05 17:00:32 +00:00
|
|
|
physicscontroller->setNewClientInfo(gameobj->getClientInfo());
|
2006-11-21 12:26:05 +00:00
|
|
|
btRigidBody* rbody = physicscontroller->GetRigidBody();
|
2006-02-22 06:58:05 +00:00
|
|
|
|
|
|
|
if (objprop->m_disableSleeping)
|
2006-11-21 12:26:05 +00:00
|
|
|
rbody->setActivationState(DISABLE_DEACTIVATION);
|
2006-02-22 06:58:05 +00:00
|
|
|
|
2008-03-15 20:52:03 +00:00
|
|
|
//Now done directly in ci.m_collisionFlags so that it propagates to replica
|
|
|
|
//if (objprop->m_ghost)
|
|
|
|
//{
|
|
|
|
// rbody->setCollisionFlags(rbody->getCollisionFlags() | btCollisionObject::CF_NO_CONTACT_RESPONSE);
|
|
|
|
//}
|
2008-05-01 16:00:59 +00:00
|
|
|
|
2006-08-28 06:44:29 +00:00
|
|
|
if (objprop->m_dyna && !objprop->m_angular_rigidbody)
|
2006-04-26 06:01:46 +00:00
|
|
|
{
|
|
|
|
/*
|
|
|
|
//setting the inertia could achieve similar results to constraint the up
|
|
|
|
//but it is prone to instability, so use special 'Angular' constraint
|
2006-11-21 00:53:40 +00:00
|
|
|
btVector3 inertia = physicscontroller->GetRigidBody()->getInvInertiaDiagLocal();
|
2006-04-26 06:01:46 +00:00
|
|
|
inertia.setX(0.f);
|
|
|
|
inertia.setZ(0.f);
|
|
|
|
|
|
|
|
physicscontroller->GetRigidBody()->setInvInertiaDiagLocal(inertia);
|
|
|
|
physicscontroller->GetRigidBody()->updateInertiaTensor();
|
|
|
|
*/
|
|
|
|
|
2006-12-04 04:31:34 +00:00
|
|
|
//env->createConstraint(physicscontroller,0,PHY_ANGULAR_CONSTRAINT,0,0,0,0,0,1);
|
2008-05-01 16:00:59 +00:00
|
|
|
|
|
|
|
//Now done directly in ci.m_bRigid so that it propagates to replica
|
|
|
|
//physicscontroller->GetRigidBody()->setAngularFactor(0.f);
|
|
|
|
;
|
2006-04-26 06:01:46 +00:00
|
|
|
}
|
|
|
|
|
2005-08-05 17:00:32 +00:00
|
|
|
bool isActor = objprop->m_isactor;
|
|
|
|
gameobj->getClientInfo()->m_type = (isActor ? KX_ClientObjectInfo::ACTOR : KX_ClientObjectInfo::STATIC);
|
|
|
|
// store materialname in auxinfo, needed for touchsensors
|
2006-04-28 17:35:03 +00:00
|
|
|
if (meshobj)
|
|
|
|
{
|
|
|
|
const STR_String& matname=meshobj->GetMaterialName(0);
|
|
|
|
gameobj->getClientInfo()->m_auxilary_info = (matname.Length() ? (void*)(matname.ReadPtr()+2) : NULL);
|
|
|
|
} else
|
|
|
|
{
|
|
|
|
gameobj->getClientInfo()->m_auxilary_info = 0;
|
|
|
|
}
|
2005-08-05 17:00:32 +00:00
|
|
|
|
|
|
|
|
2005-07-16 21:47:54 +00:00
|
|
|
gameobj->GetSGNode()->AddSGController(physicscontroller);
|
|
|
|
|
|
|
|
STR_String materialname;
|
|
|
|
if (meshobj)
|
|
|
|
materialname = meshobj->GetMaterialName(0);
|
|
|
|
|
|
|
|
physicscontroller->SetObject(gameobj->GetSGNode());
|
|
|
|
|
|
|
|
}
|
2006-12-01 03:29:20 +00:00
|
|
|
|
|
|
|
|
2005-07-16 21:47:54 +00:00
|
|
|
void KX_ClearBulletSharedShapes()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
2006-01-05 23:10:54 +00:00
|
|
|
|