forked from bartvdbraak/blender
enable -noaudio option, so it actually works (and doesn't get overwritten by a game flag). audio initialization delays startup of game engine 2 seconds
add -nojoystick commandline option: it takes 5 seconds everytime to start the game engine, while there IS no joystick. In other words: blender -noaudio -nojoystick improves workflow turnaround times for P - ESC from 7 seconds to 1 second! Improved Bullet soft body advanced options, still work-in-progress. Make sure to create game Bullet soft bodies from scratch, it is not compatible with last weeks builds.
This commit is contained in:
parent
a765f54b1a
commit
f8fb61f9fa
@ -45,10 +45,43 @@ BulletSoftBody *bsbNew(void)
|
|||||||
|
|
||||||
bsb= MEM_callocN(sizeof(BulletSoftBody), "bulletsoftbody");
|
bsb= MEM_callocN(sizeof(BulletSoftBody), "bulletsoftbody");
|
||||||
|
|
||||||
bsb->flag = OB_BSB_SHAPE_MATCHING;
|
bsb->flag = OB_BSB_BENDING_CONSTRAINTS | OB_BSB_SHAPE_MATCHING | OB_BSB_AERO_VPOINT;
|
||||||
bsb->linStiff = 0.5f;
|
bsb->linStiff = 0.5f;
|
||||||
bsb->angStiff = 1.0f;
|
bsb->angStiff = 1.0f;
|
||||||
bsb->volume = 1.0f;
|
bsb->volume = 1.0f;
|
||||||
|
|
||||||
|
|
||||||
|
bsb->viterations = 0;
|
||||||
|
bsb->piterations = 2;
|
||||||
|
bsb->diterations = 0;
|
||||||
|
bsb->citerations = 4;
|
||||||
|
|
||||||
|
bsb->kSRHR_CL = 0.1f;
|
||||||
|
bsb->kSKHR_CL = 1.f;
|
||||||
|
bsb->kSSHR_CL = 0.5f;
|
||||||
|
bsb->kSR_SPLT_CL = 0.5f;
|
||||||
|
|
||||||
|
bsb->kSK_SPLT_CL = 0.5f;
|
||||||
|
bsb->kSS_SPLT_CL = 0.5f;
|
||||||
|
bsb->kVCF = 1;
|
||||||
|
bsb->kDP = 0;
|
||||||
|
|
||||||
|
bsb->kDG = 0;
|
||||||
|
bsb->kLF = 0;
|
||||||
|
bsb->kPR = 0;
|
||||||
|
bsb->kVC = 0;
|
||||||
|
|
||||||
|
bsb->kDF = 0.2f;
|
||||||
|
bsb->kMT = 0.05;
|
||||||
|
bsb->kCHR = 1.0f;
|
||||||
|
bsb->kKHR = 0.1f;
|
||||||
|
|
||||||
|
bsb->kSHR = 1.0f;
|
||||||
|
bsb->kAHR = 0.7f;
|
||||||
|
bsb->collisionflags = 0;
|
||||||
|
//bsb->collisionflags = OB_BSB_COL_CL_RS + OB_BSB_COL_CL_SS;
|
||||||
|
bsb->numclusteriterations = 64;
|
||||||
|
|
||||||
return bsb;
|
return bsb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,14 +85,56 @@ typedef struct SBVertex {
|
|||||||
} SBVertex;
|
} SBVertex;
|
||||||
|
|
||||||
typedef struct BulletSoftBody {
|
typedef struct BulletSoftBody {
|
||||||
int flag; /* various boolean options */
|
int flag; /* various boolean options */
|
||||||
float linStiff; /* linear stiffness 0..1 */
|
float linStiff; /* linear stiffness 0..1 */
|
||||||
float angStiff; /* angular stiffness 0..1 */
|
float angStiff; /* angular stiffness 0..1 */
|
||||||
float volume; /* volume preservation 0..1 */
|
float volume; /* volume preservation 0..1 */
|
||||||
|
|
||||||
|
int viterations; /* Velocities solver iterations */
|
||||||
|
int piterations; /* Positions solver iterations */
|
||||||
|
int diterations; /* Drift solver iterations */
|
||||||
|
int citerations; /* Cluster solver iterations */
|
||||||
|
|
||||||
|
float kSRHR_CL; /* Soft vs rigid hardness [0,1] (cluster only) */
|
||||||
|
float kSKHR_CL; /* Soft vs kinetic hardness [0,1] (cluster only) */
|
||||||
|
float kSSHR_CL; /* Soft vs soft hardness [0,1] (cluster only) */
|
||||||
|
float kSR_SPLT_CL; /* Soft vs rigid impulse split [0,1] (cluster only) */
|
||||||
|
|
||||||
|
float kSK_SPLT_CL; /* Soft vs rigid impulse split [0,1] (cluster only) */
|
||||||
|
float kSS_SPLT_CL; /* Soft vs rigid impulse split [0,1] (cluster only) */
|
||||||
|
float kVCF; /* Velocities correction factor (Baumgarte) */
|
||||||
|
float kDP; /* Damping coefficient [0,1] */
|
||||||
|
|
||||||
|
float kDG; /* Drag coefficient [0,+inf] */
|
||||||
|
float kLF; /* Lift coefficient [0,+inf] */
|
||||||
|
float kPR; /* Pressure coefficient [-inf,+inf] */
|
||||||
|
float kVC; /* Volume conversation coefficient [0,+inf] */
|
||||||
|
|
||||||
|
float kDF; /* Dynamic friction coefficient [0,1] */
|
||||||
|
float kMT; /* Pose matching coefficient [0,1] */
|
||||||
|
float kCHR; /* Rigid contacts hardness [0,1] */
|
||||||
|
float kKHR; /* Kinetic contacts hardness [0,1] */
|
||||||
|
|
||||||
|
float kSHR; /* Soft contacts hardness [0,1] */
|
||||||
|
float kAHR; /* Anchors hardness [0,1] */
|
||||||
|
int collisionflags; /* Vertex/Face or Signed Distance Field(SDF) or Clusters, Soft versus Soft or Rigid */
|
||||||
|
int numclusteriterations; /* number of iterations to refine collision clusters*/
|
||||||
|
|
||||||
} BulletSoftBody;
|
} BulletSoftBody;
|
||||||
|
|
||||||
/* BulletSoftBody.flag */
|
/* BulletSoftBody.flag */
|
||||||
#define OB_BSB_SHAPE_MATCHING 2
|
#define OB_BSB_SHAPE_MATCHING 2
|
||||||
|
#define OB_BSB_UNUSED 4
|
||||||
|
#define OB_BSB_BENDING_CONSTRAINTS 8
|
||||||
|
#define OB_BSB_AERO_VPOINT 16 /* aero model, Vertex normals are oriented toward velocity*/
|
||||||
|
#define OB_BSB_AERO_VTWOSIDE 32 /* aero model, Vertex normals are flipped to match velocity */
|
||||||
|
|
||||||
|
/* BulletSoftBody.collisionflags */
|
||||||
|
#define OB_BSB_COL_SDF_RS 2 /* SDF based rigid vs soft */
|
||||||
|
#define OB_BSB_COL_CL_RS 4 /* Cluster based rigid vs soft */
|
||||||
|
#define OB_BSB_COL_CL_SS 8 /* Cluster based soft vs soft */
|
||||||
|
#define OB_BSB_COL_VF_SS 16 /* Vertex/Face based soft vs soft */
|
||||||
|
|
||||||
|
|
||||||
typedef struct SoftBody {
|
typedef struct SoftBody {
|
||||||
struct ParticleSystem *particles; /* particlesystem softbody */
|
struct ParticleSystem *particles; /* particlesystem softbody */
|
||||||
|
@ -2970,6 +2970,9 @@ static void check_body_type(void *arg1_but, void *arg2_object)
|
|||||||
ob->gameflag |= OB_BOUNDS;
|
ob->gameflag |= OB_BOUNDS;
|
||||||
if (ob->boundtype<OB_BOUND_POLYH)
|
if (ob->boundtype<OB_BOUND_POLYH)
|
||||||
ob->boundtype=OB_BOUND_POLYH;
|
ob->boundtype=OB_BOUND_POLYH;
|
||||||
|
/* create a BulletSoftBody structure if not already existing */
|
||||||
|
if (!ob->bsoft)
|
||||||
|
ob->bsoft = bsbNew();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2984,55 +2987,88 @@ static uiBlock *advanced_bullet_menu(void *arg_ob)
|
|||||||
/* use this for a fake extra empy space around the buttons */
|
/* use this for a fake extra empy space around the buttons */
|
||||||
uiDefBut(block, LABEL, 0, "", -5, -10, 255, 140, NULL, 0, 0, 0, 0, "");
|
uiDefBut(block, LABEL, 0, "", -5, -10, 255, 140, NULL, 0, 0, 0, 0, "");
|
||||||
|
|
||||||
uiDefButBitI(block, TOG, OB_ACTOR, 0, "Sensor actor",
|
if (ob->gameflag & OB_SOFT_BODY) {
|
||||||
xco, yco, 118, 19, &ob->gameflag, 0, 0, 0, 0,
|
|
||||||
"Objects that are detected by the Near and Radar sensor");
|
|
||||||
|
|
||||||
if (ob->gameflag & OB_DYNAMIC) {
|
|
||||||
uiDefButBitI(block, TOG, OB_COLLISION_RESPONSE, 0, "No sleeping",
|
|
||||||
xco+=120, yco, 118, 19, &ob->gameflag, 0, 0, 0, 0,
|
|
||||||
"Disable auto (de)activation");
|
|
||||||
}
|
|
||||||
|
|
||||||
yco -= 25;
|
|
||||||
xco = 0;
|
|
||||||
if (ob->gameflag & OB_DYNAMIC) {
|
|
||||||
if (ob->margin < 0.001f)
|
|
||||||
ob->margin = 0.06f;
|
|
||||||
uiDefButF(block, NUM, 0, "Margin",
|
|
||||||
xco, yco, 118, 19, &ob->margin, 0.001, 1.0, 1, 0,
|
|
||||||
"Collision margin");
|
|
||||||
} else {
|
|
||||||
uiDefButF(block, NUM, 0, "Margin",
|
|
||||||
xco, yco, 118, 19, &ob->margin, 0.0, 1.0, 1, 0,
|
|
||||||
"Collision margin");
|
|
||||||
}
|
|
||||||
if (ob->gameflag & OB_SOFT_BODY) {
|
|
||||||
/* create a BulletSoftBody structure if not already existing */
|
|
||||||
if (!ob->bsoft)
|
|
||||||
ob->bsoft = bsbNew();
|
|
||||||
if (ob->bsoft)
|
if (ob->bsoft)
|
||||||
{
|
{
|
||||||
uiDefButBitI(block, TOG, OB_BSB_SHAPE_MATCHING, 0, "Shape matching",
|
|
||||||
xco+=120, yco, 118, 19, &ob->bsoft->flag, 0, 0, 0, 0,
|
|
||||||
"Enable soft body shape matching goal");
|
|
||||||
yco -= 25;
|
|
||||||
xco = 0;
|
xco = 0;
|
||||||
uiDefButF(block, NUMSLI, 0, "LinStiff ", xco, yco, 238, 19,
|
uiDefButF(block, NUMSLI, 0, "LinStiff ", xco, yco, 238, 19,
|
||||||
&ob->bsoft->linStiff, 0.0, 1.0, 1, 0,
|
&ob->bsoft->linStiff, 0.0, 1.0, 1, 0,
|
||||||
"Linear stiffness of the soft body vertex spring");
|
"Linear stiffness of the soft body vertex spring");
|
||||||
yco -= 25;
|
yco -= 25;
|
||||||
|
xco = 0;
|
||||||
|
|
||||||
|
uiDefButBitI(block, TOG, OB_BSB_SHAPE_MATCHING, 0, "Shape matching",
|
||||||
|
xco, yco, 118, 19, &ob->bsoft->flag, 0, 0, 0, 0,
|
||||||
|
"Enable soft body shape matching goal");
|
||||||
|
|
||||||
|
uiDefButBitI(block, TOG, OB_BSB_BENDING_CONSTRAINTS, 0, "Bending Constraints",
|
||||||
|
xco+=120, yco, 118, 19, &ob->bsoft->flag, 0, 0, 0, 0,
|
||||||
|
"Enable bending constraints");
|
||||||
|
|
||||||
|
yco -= 25;
|
||||||
|
xco = 0;
|
||||||
|
uiDefButBitI(block, TOG, OB_BSB_COL_CL_RS, 0, "Cluster Col. RS",
|
||||||
|
xco, yco, 118, 19, &ob->bsoft->collisionflags, 0, 0, 0, 0,
|
||||||
|
"Enable cluster collision between soft and rigid body");
|
||||||
|
uiDefButBitI(block, TOG, OB_BSB_COL_CL_SS, 0, "Cluster Col. SS",
|
||||||
|
xco+=120, yco, 118, 19, &ob->bsoft->collisionflags, 0, 0, 0, 0,
|
||||||
|
"Enable cluster collision between soft and soft body");
|
||||||
|
yco -= 25;
|
||||||
|
|
||||||
|
xco = 0;
|
||||||
|
/*
|
||||||
|
uiDefButBitI(block, TOG, OB_BSB_AERO_VTWOSIDE, 0, "Aero model",
|
||||||
|
xco, yco, 118, 19, &ob->bsoft->flag, 0, 0, 0, 0,
|
||||||
|
"Enable aero model, vertex normals are flipped to match velocity");
|
||||||
|
|
||||||
|
yco -= 25;
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
uiDefButF(block, NUMSLI, 0, "AngStiff ", xco, yco, 238, 19,
|
uiDefButF(block, NUMSLI, 0, "AngStiff ", xco, yco, 238, 19,
|
||||||
&ob->bsoft->angStiff, 0.0, 1.0, 1, 0,
|
&ob->bsoft->angStiff, 0.0, 1.0, 1, 0,
|
||||||
"Angular stiffness of the soft body vertex spring");
|
"Angular stiffness of the soft body vertex spring");
|
||||||
yco -= 25;
|
yco -= 25;
|
||||||
uiDefButF(block, NUMSLI, 0, "Volume ", xco, yco, 238, 19,
|
uiDefButF(block, NUMSLI, 0, "Volume ", xco, yco, 238, 19,
|
||||||
&ob->bsoft->volume, 0.0, 1.0, 1, 0,
|
&ob->bsoft->volume, 0.0, 1.0, 1, 0,
|
||||||
"Factor of soft body volume preservation");
|
"Factor of soft body volume preservation");
|
||||||
|
*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} else
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
xco = 0;
|
||||||
|
|
||||||
|
uiDefButBitI(block, TOG, OB_ACTOR, 0, "Sensor actor",
|
||||||
|
xco, yco, 118, 19, &ob->gameflag, 0, 0, 0, 0,
|
||||||
|
"Objects that are detected by the Near and Radar sensor");
|
||||||
|
|
||||||
|
if (ob->gameflag & OB_DYNAMIC) {
|
||||||
|
uiDefButBitI(block, TOG, OB_COLLISION_RESPONSE, 0, "No sleeping",
|
||||||
|
xco+=120, yco, 118, 19, &ob->gameflag, 0, 0, 0, 0,
|
||||||
|
"Disable auto (de)activation");
|
||||||
|
}
|
||||||
|
|
||||||
|
yco -= 25;
|
||||||
|
xco = 0;
|
||||||
|
if (ob->gameflag & OB_DYNAMIC) {
|
||||||
|
if (ob->margin < 0.001f)
|
||||||
|
ob->margin = 0.06f;
|
||||||
|
uiDefButF(block, NUM, 0, "Margin",
|
||||||
|
xco, yco, 118, 19, &ob->margin, 0.001, 1.0, 1, 0,
|
||||||
|
"Collision margin");
|
||||||
|
} else {
|
||||||
|
uiDefButF(block, NUM, 0, "Margin",
|
||||||
|
xco, yco, 118, 19, &ob->margin, 0.0, 1.0, 1, 0,
|
||||||
|
"Collision margin");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
uiBlockSetDirection(block, UI_TOP);
|
uiBlockSetDirection(block, UI_TOP);
|
||||||
|
|
||||||
|
@ -388,7 +388,11 @@ void space_set_commmandline_options(void) {
|
|||||||
if ( (syshandle = SYS_GetSystem()) ) {
|
if ( (syshandle = SYS_GetSystem()) ) {
|
||||||
/* User defined settings */
|
/* User defined settings */
|
||||||
a= (U.gameflags & USER_DISABLE_SOUND);
|
a= (U.gameflags & USER_DISABLE_SOUND);
|
||||||
SYS_WriteCommandLineInt(syshandle, "noaudio", a);
|
/* if user already disabled audio at the command-line, don't re-enable it */
|
||||||
|
if (a)
|
||||||
|
{
|
||||||
|
SYS_WriteCommandLineInt(syshandle, "noaudio", a);
|
||||||
|
}
|
||||||
|
|
||||||
a= (U.gameflags & USER_DISABLE_MIPMAP);
|
a= (U.gameflags & USER_DISABLE_MIPMAP);
|
||||||
GPU_set_mipmap(!a);
|
GPU_set_mipmap(!a);
|
||||||
|
@ -219,6 +219,7 @@ static void print_help(void)
|
|||||||
printf ("\nMisc options:\n");
|
printf ("\nMisc options:\n");
|
||||||
printf (" -d\t\tTurn debugging on\n");
|
printf (" -d\t\tTurn debugging on\n");
|
||||||
printf (" -noaudio\tDisable audio on systems that support audio\n");
|
printf (" -noaudio\tDisable audio on systems that support audio\n");
|
||||||
|
printf (" -nojoystick\tDisable joystick support\n");
|
||||||
printf (" -h\t\tPrint this help text\n");
|
printf (" -h\t\tPrint this help text\n");
|
||||||
printf (" -y\t\tDisable automatic python script execution (scriptlinks, pydrivers, pyconstraints, pynodes)\n");
|
printf (" -y\t\tDisable automatic python script execution (scriptlinks, pydrivers, pyconstraints, pynodes)\n");
|
||||||
printf (" -P <filename>\tRun the given Python script (filename or Blender Text)\n");
|
printf (" -P <filename>\tRun the given Python script (filename or Blender Text)\n");
|
||||||
@ -493,6 +494,14 @@ int main(int argc, char **argv)
|
|||||||
audio = 0;
|
audio = 0;
|
||||||
if (G.f & G_DEBUG) printf("setting audio to: %d\n", audio);
|
if (G.f & G_DEBUG) printf("setting audio to: %d\n", audio);
|
||||||
}
|
}
|
||||||
|
if (BLI_strcasecmp(argv[a], "-nojoystick") == 0) {
|
||||||
|
/**
|
||||||
|
don't initialize joysticks if user doesn't want to use joysticks
|
||||||
|
failed joystick initialization delays over 5 seconds, before game engine start
|
||||||
|
*/
|
||||||
|
SYS_WriteCommandLineInt(syshandle,"nojoystick",1);
|
||||||
|
if (G.f & G_DEBUG) printf("disabling nojoystick\n");
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -170,6 +170,13 @@ extern "C" void StartKetsjiShell(struct ScrArea *area,
|
|||||||
NG_NetworkDeviceInterface* networkdevice = new
|
NG_NetworkDeviceInterface* networkdevice = new
|
||||||
NG_LoopBackNetworkDeviceInterface();
|
NG_LoopBackNetworkDeviceInterface();
|
||||||
|
|
||||||
|
//
|
||||||
|
SYS_SystemHandle hSystem = SYS_GetSystem();
|
||||||
|
bool noaudio = SYS_GetCommandLineInt(hSystem,"noaudio",0);
|
||||||
|
|
||||||
|
if (noaudio)/*(noaudio) intrr: disable game engine audio (openal) */
|
||||||
|
SND_DeviceManager::SetDeviceType(snd_e_dummydevice);
|
||||||
|
|
||||||
// get an audiodevice
|
// get an audiodevice
|
||||||
SND_DeviceManager::Subscribe();
|
SND_DeviceManager::Subscribe();
|
||||||
SND_IAudioDevice* audiodevice = SND_DeviceManager::Instance();
|
SND_IAudioDevice* audiodevice = SND_DeviceManager::Instance();
|
||||||
|
@ -1323,20 +1323,86 @@ void BL_CreatePhysicsObjectNew(KX_GameObject* gameobj,
|
|||||||
objprop.m_softbody = (blenderobject->gameflag & OB_SOFT_BODY) != 0;
|
objprop.m_softbody = (blenderobject->gameflag & OB_SOFT_BODY) != 0;
|
||||||
objprop.m_angular_rigidbody = (blenderobject->gameflag & OB_RIGID_BODY) != 0;
|
objprop.m_angular_rigidbody = (blenderobject->gameflag & OB_RIGID_BODY) != 0;
|
||||||
|
|
||||||
///for game soft bodies
|
if (objprop.m_softbody)
|
||||||
if (blenderobject->bsoft)
|
|
||||||
{
|
{
|
||||||
objprop.m_linearStiffness = blenderobject->bsoft->linStiff;
|
///for game soft bodies
|
||||||
objprop.m_angularStiffness = blenderobject->bsoft->angStiff;
|
if (blenderobject->bsoft)
|
||||||
objprop.m_volumePreservation = blenderobject->bsoft->volume;
|
{
|
||||||
objprop.m_gamesoftFlag = blenderobject->bsoft->flag;
|
objprop.m_gamesoftFlag = blenderobject->bsoft->flag;
|
||||||
|
///////////////////
|
||||||
|
objprop.m_soft_linStiff = blenderobject->bsoft->linStiff;
|
||||||
|
objprop.m_soft_angStiff = blenderobject->bsoft->angStiff; /* angular stiffness 0..1 */
|
||||||
|
objprop.m_soft_volume= blenderobject->bsoft->volume; /* volume preservation 0..1 */
|
||||||
|
|
||||||
|
objprop.m_soft_viterations= blenderobject->bsoft->viterations; /* Velocities solver iterations */
|
||||||
|
objprop.m_soft_piterations= blenderobject->bsoft->piterations; /* Positions solver iterations */
|
||||||
|
objprop.m_soft_diterations= blenderobject->bsoft->diterations; /* Drift solver iterations */
|
||||||
|
objprop.m_soft_citerations= blenderobject->bsoft->citerations; /* Cluster solver iterations */
|
||||||
|
|
||||||
|
objprop.m_soft_kSRHR_CL= blenderobject->bsoft->kSRHR_CL; /* Soft vs rigid hardness [0,1] (cluster only) */
|
||||||
|
objprop.m_soft_kSKHR_CL= blenderobject->bsoft->kSKHR_CL; /* Soft vs kinetic hardness [0,1] (cluster only) */
|
||||||
|
objprop.m_soft_kSSHR_CL= blenderobject->bsoft->kSSHR_CL; /* Soft vs soft hardness [0,1] (cluster only) */
|
||||||
|
objprop.m_soft_kSR_SPLT_CL= blenderobject->bsoft->kSR_SPLT_CL; /* Soft vs rigid impulse split [0,1] (cluster only) */
|
||||||
|
|
||||||
|
objprop.m_soft_kSK_SPLT_CL= blenderobject->bsoft->kSK_SPLT_CL; /* Soft vs rigid impulse split [0,1] (cluster only) */
|
||||||
|
objprop.m_soft_kSS_SPLT_CL= blenderobject->bsoft->kSS_SPLT_CL; /* Soft vs rigid impulse split [0,1] (cluster only) */
|
||||||
|
objprop.m_soft_kVCF= blenderobject->bsoft->kVCF; /* Velocities correction factor (Baumgarte) */
|
||||||
|
objprop.m_soft_kDP= blenderobject->bsoft->kDP; /* Damping coefficient [0,1] */
|
||||||
|
|
||||||
|
objprop.m_soft_kDG= blenderobject->bsoft->kDG; /* Drag coefficient [0,+inf] */
|
||||||
|
objprop.m_soft_kLF= blenderobject->bsoft->kLF; /* Lift coefficient [0,+inf] */
|
||||||
|
objprop.m_soft_kPR= blenderobject->bsoft->kPR; /* Pressure coefficient [-inf,+inf] */
|
||||||
|
objprop.m_soft_kVC= blenderobject->bsoft->kVC; /* Volume conversation coefficient [0,+inf] */
|
||||||
|
|
||||||
|
objprop.m_soft_kDF= blenderobject->bsoft->kDF; /* Dynamic friction coefficient [0,1] */
|
||||||
|
objprop.m_soft_kMT= blenderobject->bsoft->kMT; /* Pose matching coefficient [0,1] */
|
||||||
|
objprop.m_soft_kCHR= blenderobject->bsoft->kCHR; /* Rigid contacts hardness [0,1] */
|
||||||
|
objprop.m_soft_kKHR= blenderobject->bsoft->kKHR; /* Kinetic contacts hardness [0,1] */
|
||||||
|
|
||||||
|
objprop.m_soft_kSHR= blenderobject->bsoft->kSHR; /* Soft contacts hardness [0,1] */
|
||||||
|
objprop.m_soft_kAHR= blenderobject->bsoft->kAHR; /* Anchors hardness [0,1] */
|
||||||
|
objprop.m_soft_collisionflags= blenderobject->bsoft->collisionflags; /* Vertex/Face or Signed Distance Field(SDF) or Clusters, Soft versus Soft or Rigid */
|
||||||
|
objprop.m_soft_numclusteriterations= blenderobject->bsoft->numclusteriterations; /* number of iterations to refine collision clusters*/
|
||||||
|
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
objprop.m_linearStiffness = 0.5;//blenderobject->bsoft->linStiff;
|
objprop.m_gamesoftFlag = OB_BSB_BENDING_CONSTRAINTS | OB_BSB_SHAPE_MATCHING | OB_BSB_AERO_VPOINT;
|
||||||
objprop.m_angularStiffness = 1.f;//blenderobject->bsoft->angStiff;
|
|
||||||
objprop.m_volumePreservation = 1.f;//blenderobject->bsoft->volume;
|
objprop.m_soft_linStiff = 0.5;;
|
||||||
objprop.m_gamesoftFlag = 1;//blenderobject->bsoft->flag;
|
objprop.m_soft_angStiff = 1.f; /* angular stiffness 0..1 */
|
||||||
|
objprop.m_soft_volume= 1.f; /* volume preservation 0..1 */
|
||||||
|
|
||||||
|
|
||||||
|
objprop.m_soft_viterations= 0;
|
||||||
|
objprop.m_soft_piterations= 1;
|
||||||
|
objprop.m_soft_diterations= 0;
|
||||||
|
objprop.m_soft_citerations= 4;
|
||||||
|
|
||||||
|
objprop.m_soft_kSRHR_CL= 0.1f;
|
||||||
|
objprop.m_soft_kSKHR_CL= 1.f;
|
||||||
|
objprop.m_soft_kSSHR_CL= 0.5;
|
||||||
|
objprop.m_soft_kSR_SPLT_CL= 0.5f;
|
||||||
|
|
||||||
|
objprop.m_soft_kSK_SPLT_CL= 0.5f;
|
||||||
|
objprop.m_soft_kSS_SPLT_CL= 0.5f;
|
||||||
|
objprop.m_soft_kVCF= 1;
|
||||||
|
objprop.m_soft_kDP= 0;
|
||||||
|
|
||||||
|
objprop.m_soft_kDG= 0;
|
||||||
|
objprop.m_soft_kLF= 0;
|
||||||
|
objprop.m_soft_kPR= 0;
|
||||||
|
objprop.m_soft_kVC= 0;
|
||||||
|
|
||||||
|
objprop.m_soft_kDF= 0.2f;
|
||||||
|
objprop.m_soft_kMT= 0.f;
|
||||||
|
objprop.m_soft_kCHR= 1.0f;
|
||||||
|
objprop.m_soft_kKHR= 0.1f;
|
||||||
|
|
||||||
|
objprop.m_soft_kSHR= 1.f;
|
||||||
|
objprop.m_soft_kAHR= 0.7f;
|
||||||
|
objprop.m_soft_collisionflags= OB_BSB_COL_SDF_RS + OB_BSB_COL_VF_SS;
|
||||||
|
objprop.m_soft_numclusteriterations= 16;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
objprop.m_ghost = (blenderobject->gameflag & OB_GHOST) != 0;
|
objprop.m_ghost = (blenderobject->gameflag & OB_GHOST) != 0;
|
||||||
|
@ -88,10 +88,44 @@ struct KX_ObjectProperties
|
|||||||
bool m_hasCompoundChildren;
|
bool m_hasCompoundChildren;
|
||||||
bool m_isCompoundChild;
|
bool m_isCompoundChild;
|
||||||
|
|
||||||
float m_linearStiffness;
|
/////////////////////////
|
||||||
float m_angularStiffness;
|
|
||||||
float m_volumePreservation;
|
|
||||||
int m_gamesoftFlag;
|
int m_gamesoftFlag;
|
||||||
|
float m_soft_linStiff; /* linear stiffness 0..1 */
|
||||||
|
float m_soft_angStiff; /* angular stiffness 0..1 */
|
||||||
|
float m_soft_volume; /* volume preservation 0..1 */
|
||||||
|
|
||||||
|
int m_soft_viterations; /* Velocities solver iterations */
|
||||||
|
int m_soft_piterations; /* Positions solver iterations */
|
||||||
|
int m_soft_diterations; /* Drift solver iterations */
|
||||||
|
int m_soft_citerations; /* Cluster solver iterations */
|
||||||
|
|
||||||
|
float m_soft_kSRHR_CL; /* Soft vs rigid hardness [0,1] (cluster only) */
|
||||||
|
float m_soft_kSKHR_CL; /* Soft vs kinetic hardness [0,1] (cluster only) */
|
||||||
|
float m_soft_kSSHR_CL; /* Soft vs soft hardness [0,1] (cluster only) */
|
||||||
|
float m_soft_kSR_SPLT_CL; /* Soft vs rigid impulse split [0,1] (cluster only) */
|
||||||
|
|
||||||
|
float m_soft_kSK_SPLT_CL; /* Soft vs rigid impulse split [0,1] (cluster only) */
|
||||||
|
float m_soft_kSS_SPLT_CL; /* Soft vs rigid impulse split [0,1] (cluster only) */
|
||||||
|
float m_soft_kVCF; /* Velocities correction factor (Baumgarte) */
|
||||||
|
float m_soft_kDP; /* Damping coefficient [0,1] */
|
||||||
|
|
||||||
|
float m_soft_kDG; /* Drag coefficient [0,+inf] */
|
||||||
|
float m_soft_kLF; /* Lift coefficient [0,+inf] */
|
||||||
|
float m_soft_kPR; /* Pressure coefficient [-inf,+inf] */
|
||||||
|
float m_soft_kVC; /* Volume conversation coefficient [0,+inf] */
|
||||||
|
|
||||||
|
float m_soft_kDF; /* Dynamic friction coefficient [0,1] */
|
||||||
|
float m_soft_kMT; /* Pose matching coefficient [0,1] */
|
||||||
|
float m_soft_kCHR; /* Rigid contacts hardness [0,1] */
|
||||||
|
float m_soft_kKHR; /* Kinetic contacts hardness [0,1] */
|
||||||
|
|
||||||
|
float m_soft_kSHR; /* Soft contacts hardness [0,1] */
|
||||||
|
float m_soft_kAHR; /* Anchors hardness [0,1] */
|
||||||
|
int m_soft_collisionflags; /* Vertex/Face or Signed Distance Field(SDF) or Clusters, Soft versus Soft or Rigid */
|
||||||
|
int m_soft_numclusteriterations; /* number of iterations to refine collision clusters*/
|
||||||
|
|
||||||
|
/////////////////////////
|
||||||
|
|
||||||
double m_margin;
|
double m_margin;
|
||||||
KX_BoundBoxClass m_boundclass;
|
KX_BoundBoxClass m_boundclass;
|
||||||
|
@ -1024,10 +1024,45 @@ void KX_ConvertBulletObject( class KX_GameObject* gameobj,
|
|||||||
ci.m_angularDamping = 1.f - shapeprops->m_ang_drag;
|
ci.m_angularDamping = 1.f - shapeprops->m_ang_drag;
|
||||||
//need a bit of damping, else system doesn't behave well
|
//need a bit of damping, else system doesn't behave well
|
||||||
ci.m_inertiaFactor = shapeprops->m_inertia/0.4f;//defaults to 0.4, don't want to change behaviour
|
ci.m_inertiaFactor = shapeprops->m_inertia/0.4f;//defaults to 0.4, don't want to change behaviour
|
||||||
ci.m_linearStiffness = objprop->m_linearStiffness;
|
|
||||||
ci.m_angularStiffness= objprop->m_angularStiffness;
|
|
||||||
ci.m_volumePreservation= objprop->m_volumePreservation;
|
///////////////////
|
||||||
ci.m_gamesoftFlag = objprop->m_gamesoftFlag;
|
ci.m_gamesoftFlag = objprop->m_gamesoftFlag;
|
||||||
|
ci.m_soft_linStiff = objprop->m_soft_linStiff;
|
||||||
|
ci.m_soft_angStiff = objprop->m_soft_angStiff; /* angular stiffness 0..1 */
|
||||||
|
ci.m_soft_volume= objprop->m_soft_volume; /* volume preservation 0..1 */
|
||||||
|
|
||||||
|
ci.m_soft_viterations= objprop->m_soft_viterations; /* Velocities solver iterations */
|
||||||
|
ci.m_soft_piterations= objprop->m_soft_piterations; /* Positions solver iterations */
|
||||||
|
ci.m_soft_diterations= objprop->m_soft_diterations; /* Drift solver iterations */
|
||||||
|
ci.m_soft_citerations= objprop->m_soft_citerations; /* Cluster solver iterations */
|
||||||
|
|
||||||
|
ci.m_soft_kSRHR_CL= objprop->m_soft_kSRHR_CL; /* Soft vs rigid hardness [0,1] (cluster only) */
|
||||||
|
ci.m_soft_kSKHR_CL= objprop->m_soft_kSKHR_CL; /* Soft vs kinetic hardness [0,1] (cluster only) */
|
||||||
|
ci.m_soft_kSSHR_CL= objprop->m_soft_kSSHR_CL; /* Soft vs soft hardness [0,1] (cluster only) */
|
||||||
|
ci.m_soft_kSR_SPLT_CL= objprop->m_soft_kSR_SPLT_CL; /* Soft vs rigid impulse split [0,1] (cluster only) */
|
||||||
|
|
||||||
|
ci.m_soft_kSK_SPLT_CL= objprop->m_soft_kSK_SPLT_CL; /* Soft vs rigid impulse split [0,1] (cluster only) */
|
||||||
|
ci.m_soft_kSS_SPLT_CL= objprop->m_soft_kSS_SPLT_CL; /* Soft vs rigid impulse split [0,1] (cluster only) */
|
||||||
|
ci.m_soft_kVCF= objprop->m_soft_kVCF; /* Velocities correction factor (Baumgarte) */
|
||||||
|
ci.m_soft_kDP= objprop->m_soft_kDP; /* Damping coefficient [0,1] */
|
||||||
|
|
||||||
|
ci.m_soft_kDG= objprop->m_soft_kDG; /* Drag coefficient [0,+inf] */
|
||||||
|
ci.m_soft_kLF= objprop->m_soft_kLF; /* Lift coefficient [0,+inf] */
|
||||||
|
ci.m_soft_kPR= objprop->m_soft_kPR; /* Pressure coefficient [-inf,+inf] */
|
||||||
|
ci.m_soft_kVC= objprop->m_soft_kVC; /* Volume conversation coefficient [0,+inf] */
|
||||||
|
|
||||||
|
ci.m_soft_kDF= objprop->m_soft_kDF; /* Dynamic friction coefficient [0,1] */
|
||||||
|
ci.m_soft_kMT= objprop->m_soft_kMT; /* Pose matching coefficient [0,1] */
|
||||||
|
ci.m_soft_kCHR= objprop->m_soft_kCHR; /* Rigid contacts hardness [0,1] */
|
||||||
|
ci.m_soft_kKHR= objprop->m_soft_kKHR; /* Kinetic contacts hardness [0,1] */
|
||||||
|
|
||||||
|
ci.m_soft_kSHR= objprop->m_soft_kSHR; /* Soft contacts hardness [0,1] */
|
||||||
|
ci.m_soft_kAHR= objprop->m_soft_kAHR; /* Anchors hardness [0,1] */
|
||||||
|
ci.m_soft_collisionflags= objprop->m_soft_collisionflags; /* Vertex/Face or Signed Distance Field(SDF) or Clusters, Soft versus Soft or Rigid */
|
||||||
|
ci.m_soft_numclusteriterations= objprop->m_soft_numclusteriterations; /* number of iterations to refine collision clusters*/
|
||||||
|
|
||||||
|
////////////////////
|
||||||
|
|
||||||
ci.m_collisionFilterGroup = (isbulletdyna) ? short(CcdConstructionInfo::DefaultFilter) : short(CcdConstructionInfo::StaticFilter);
|
ci.m_collisionFilterGroup = (isbulletdyna) ? short(CcdConstructionInfo::DefaultFilter) : short(CcdConstructionInfo::StaticFilter);
|
||||||
ci.m_collisionFilterMask = (isbulletdyna) ? short(CcdConstructionInfo::AllFilter) : short(CcdConstructionInfo::AllFilter ^ CcdConstructionInfo::StaticFilter);
|
ci.m_collisionFilterMask = (isbulletdyna) ? short(CcdConstructionInfo::AllFilter) : short(CcdConstructionInfo::AllFilter ^ CcdConstructionInfo::StaticFilter);
|
||||||
|
@ -159,7 +159,7 @@ KX_Scene::KX_Scene(class SCA_IInputDevice* keyboarddevice,
|
|||||||
|
|
||||||
KX_NetworkEventManager* netmgr = new KX_NetworkEventManager(m_logicmgr, ndi);
|
KX_NetworkEventManager* netmgr = new KX_NetworkEventManager(m_logicmgr, ndi);
|
||||||
|
|
||||||
SCA_JoystickManager *joymgr = new SCA_JoystickManager(m_logicmgr);
|
|
||||||
|
|
||||||
m_logicmgr->RegisterEventManager(alwaysmgr);
|
m_logicmgr->RegisterEventManager(alwaysmgr);
|
||||||
m_logicmgr->RegisterEventManager(propmgr);
|
m_logicmgr->RegisterEventManager(propmgr);
|
||||||
@ -170,7 +170,15 @@ KX_Scene::KX_Scene(class SCA_IInputDevice* keyboarddevice,
|
|||||||
m_logicmgr->RegisterEventManager(rndmgr);
|
m_logicmgr->RegisterEventManager(rndmgr);
|
||||||
m_logicmgr->RegisterEventManager(raymgr);
|
m_logicmgr->RegisterEventManager(raymgr);
|
||||||
m_logicmgr->RegisterEventManager(netmgr);
|
m_logicmgr->RegisterEventManager(netmgr);
|
||||||
m_logicmgr->RegisterEventManager(joymgr);
|
|
||||||
|
|
||||||
|
SYS_SystemHandle hSystem = SYS_GetSystem();
|
||||||
|
bool nojoystick= SYS_GetCommandLineInt(hSystem,"nojoystick",0);
|
||||||
|
if (!nojoystick)
|
||||||
|
{
|
||||||
|
SCA_JoystickManager *joymgr = new SCA_JoystickManager(m_logicmgr);
|
||||||
|
m_logicmgr->RegisterEventManager(joymgr);
|
||||||
|
}
|
||||||
|
|
||||||
m_soundScene = new SND_Scene(adi);
|
m_soundScene = new SND_Scene(adi);
|
||||||
MT_assert (m_networkDeviceInterface != NULL);
|
MT_assert (m_networkDeviceInterface != NULL);
|
||||||
|
@ -288,26 +288,69 @@ void CcdPhysicsController::CreateRigidbody()
|
|||||||
m_object = psb;
|
m_object = psb;
|
||||||
|
|
||||||
//psb->m_cfg.collisions = btSoftBody::fCollision::SDF_RS;//btSoftBody::fCollision::CL_SS+ btSoftBody::fCollision::CL_RS;
|
//psb->m_cfg.collisions = btSoftBody::fCollision::SDF_RS;//btSoftBody::fCollision::CL_SS+ btSoftBody::fCollision::CL_RS;
|
||||||
psb->m_cfg.collisions = btSoftBody::fCollision::SDF_RS + btSoftBody::fCollision::VF_SS;//CL_SS;
|
|
||||||
//psb->m_cfg.collisions = btSoftBody::fCollision::CL_SS + btSoftBody::fCollision::CL_RS;
|
//psb->m_cfg.collisions = btSoftBody::fCollision::SDF_RS + btSoftBody::fCollision::VF_SS;//CL_SS;
|
||||||
|
|
||||||
|
|
||||||
//btSoftBody::Material* pm=psb->appendMaterial();
|
//btSoftBody::Material* pm=psb->appendMaterial();
|
||||||
btSoftBody::Material* pm=psb->m_materials[0];
|
btSoftBody::Material* pm=psb->m_materials[0];
|
||||||
|
pm->m_kLST = m_cci.m_soft_linStiff;
|
||||||
pm->m_kLST = m_cci.m_linearStiffness;
|
pm->m_kAST = m_cci.m_soft_angStiff;
|
||||||
pm->m_kAST = m_cci.m_angularStiffness;
|
pm->m_kVST = m_cci.m_soft_volume;
|
||||||
pm->m_kVST = m_cci.m_volumePreservation;
|
psb->m_cfg.collisions = 0;
|
||||||
|
|
||||||
|
|
||||||
|
if (m_cci.m_soft_collisionflags & CCD_BSB_COL_CL_RS)
|
||||||
//pm->m_kAST = 0.01f;
|
{
|
||||||
//pm->m_kVST = 0.001f;
|
psb->m_cfg.collisions += btSoftBody::fCollision::CL_RS;
|
||||||
psb->generateBendingConstraints(2,pm);
|
} else
|
||||||
psb->m_cfg.piterations = 4;
|
{
|
||||||
psb->m_cfg.viterations = 4;
|
psb->m_cfg.collisions += btSoftBody::fCollision::SDF_RS;
|
||||||
psb->m_cfg.diterations = 4;
|
}
|
||||||
psb->m_cfg.citerations = 4;
|
if (m_cci.m_soft_collisionflags & CCD_BSB_COL_CL_SS)
|
||||||
if (m_cci.m_gamesoftFlag & 2)//OB_SB_GOAL)
|
{
|
||||||
|
psb->m_cfg.collisions += btSoftBody::fCollision::CL_SS;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
psb->m_cfg.collisions += btSoftBody::fCollision::VF_SS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
psb->m_cfg.kSRHR_CL = m_cci.m_soft_kSRHR_CL; /* Soft vs rigid hardness [0,1] (cluster only) */
|
||||||
|
psb->m_cfg.kSKHR_CL = m_cci.m_soft_kSKHR_CL; /* Soft vs kinetic hardness [0,1] (cluster only) */
|
||||||
|
psb->m_cfg.kSSHR_CL = m_cci.m_soft_kSSHR_CL; /* Soft vs soft hardness [0,1] (cluster only) */
|
||||||
|
psb->m_cfg.kSR_SPLT_CL = m_cci.m_soft_kSR_SPLT_CL; /* Soft vs rigid impulse split [0,1] (cluster only) */
|
||||||
|
|
||||||
|
psb->m_cfg.kSK_SPLT_CL = m_cci.m_soft_kSK_SPLT_CL; /* Soft vs rigid impulse split [0,1] (cluster only) */
|
||||||
|
psb->m_cfg.kSS_SPLT_CL = m_cci.m_soft_kSS_SPLT_CL; /* Soft vs rigid impulse split [0,1] (cluster only) */
|
||||||
|
psb->m_cfg.kVCF = m_cci.m_soft_kVCF; /* Velocities correction factor (Baumgarte) */
|
||||||
|
psb->m_cfg.kDP = m_cci.m_soft_kDP; /* Damping coefficient [0,1] */
|
||||||
|
|
||||||
|
psb->m_cfg.kDG = m_cci.m_soft_kDG; /* Drag coefficient [0,+inf] */
|
||||||
|
psb->m_cfg.kLF = m_cci.m_soft_kLF; /* Lift coefficient [0,+inf] */
|
||||||
|
psb->m_cfg.kPR = m_cci.m_soft_kPR; /* Pressure coefficient [-inf,+inf] */
|
||||||
|
psb->m_cfg.kVC = m_cci.m_soft_kVC; /* Volume conversation coefficient [0,+inf] */
|
||||||
|
|
||||||
|
psb->m_cfg.kDF = m_cci.m_soft_kDF; /* Dynamic friction coefficient [0,1] */
|
||||||
|
psb->m_cfg.kMT = m_cci.m_soft_kMT; /* Pose matching coefficient [0,1] */
|
||||||
|
psb->m_cfg.kCHR = m_cci.m_soft_kCHR; /* Rigid contacts hardness [0,1] */
|
||||||
|
psb->m_cfg.kKHR = m_cci.m_soft_kKHR; /* Kinetic contacts hardness [0,1] */
|
||||||
|
|
||||||
|
psb->m_cfg.kSHR = m_cci.m_soft_kSHR; /* Soft contacts hardness [0,1] */
|
||||||
|
psb->m_cfg.kAHR = m_cci.m_soft_kAHR; /* Anchors hardness [0,1] */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (m_cci.m_gamesoftFlag & CCD_BSB_BENDING_CONSTRAINTS)//OB_SB_GOAL)
|
||||||
|
{
|
||||||
|
psb->generateBendingConstraints(2,pm);
|
||||||
|
}
|
||||||
|
|
||||||
|
psb->m_cfg.piterations = m_cci.m_soft_piterations;
|
||||||
|
psb->m_cfg.viterations = m_cci.m_soft_viterations;
|
||||||
|
psb->m_cfg.diterations = m_cci.m_soft_diterations;
|
||||||
|
psb->m_cfg.citerations = m_cci.m_soft_citerations;
|
||||||
|
|
||||||
|
if (m_cci.m_gamesoftFlag & CCD_BSB_SHAPE_MATCHING)//OB_SB_GOAL)
|
||||||
{
|
{
|
||||||
psb->setPose(false,true);//
|
psb->setPose(false,true);//
|
||||||
} else
|
} else
|
||||||
@ -315,27 +358,14 @@ void CcdPhysicsController::CreateRigidbody()
|
|||||||
psb->setPose(true,false);
|
psb->setPose(true,false);
|
||||||
}
|
}
|
||||||
|
|
||||||
psb->m_cfg.kDF = 0.5;
|
|
||||||
//psb->m_cfg.kMT = 0.05;
|
|
||||||
psb->m_cfg.piterations = 5;
|
|
||||||
|
|
||||||
psb->m_cfg.piterations = 5;
|
|
||||||
//psb->m_cfg.kVC = 20;
|
|
||||||
|
|
||||||
|
|
||||||
psb->randomizeConstraints();
|
psb->randomizeConstraints();
|
||||||
|
|
||||||
/*
|
if (m_cci.m_soft_collisionflags & (CCD_BSB_COL_CL_RS+CCD_BSB_COL_CL_SS))
|
||||||
psb->m_cfg.kDF = 0.1f;//1.f;
|
{
|
||||||
psb->m_cfg.kDP = 0.0001;
|
psb->generateClusters(m_cci.m_soft_numclusteriterations);
|
||||||
//psb->m_cfg.kDP = 0.005;
|
}
|
||||||
psb->m_cfg.kCHR = 0.1;
|
|
||||||
//psb->m_cfg.kVCF = 0.1f;
|
|
||||||
psb->m_cfg.kVCF = 0.0001f;
|
|
||||||
//psb->m_cfg.kAHR = 0.1f;
|
|
||||||
psb->m_cfg.kAHR = 0.0001f;
|
|
||||||
psb->m_cfg.kMT = 0.1f;
|
|
||||||
//psb->m_cfg.kDF=1;
|
|
||||||
*/
|
|
||||||
|
|
||||||
// psb->activate();
|
// psb->activate();
|
||||||
// psb->setActivationState(1);
|
// psb->setActivationState(1);
|
||||||
@ -343,14 +373,10 @@ void CcdPhysicsController::CreateRigidbody()
|
|||||||
|
|
||||||
//psb->m_materials[0]->m_kLST = 0.1+(i/(btScalar)(n-1))*0.9;
|
//psb->m_materials[0]->m_kLST = 0.1+(i/(btScalar)(n-1))*0.9;
|
||||||
psb->setTotalMass(m_cci.m_mass);
|
psb->setTotalMass(m_cci.m_mass);
|
||||||
psb->generateClusters(64);
|
|
||||||
psb->setCollisionFlags(0);
|
psb->setCollisionFlags(0);
|
||||||
|
|
||||||
|
///create a mapping between graphics mesh vertices and soft body vertices
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
///create a mapping between graphics mesh vertices and soft body vertices
|
|
||||||
{
|
{
|
||||||
RAS_MeshObject* rasMesh= GetShapeInfo()->GetMesh();
|
RAS_MeshObject* rasMesh= GetShapeInfo()->GetMesh();
|
||||||
|
|
||||||
|
@ -38,6 +38,20 @@ class btMotionState;
|
|||||||
class RAS_MeshObject;
|
class RAS_MeshObject;
|
||||||
class btCollisionShape;
|
class btCollisionShape;
|
||||||
|
|
||||||
|
|
||||||
|
#define CCD_BSB_SHAPE_MATCHING 2
|
||||||
|
#define CCD_BSB_BENDING_CONSTRAINTS 8
|
||||||
|
#define CCD_BSB_AERO_VPOINT 16 /* aero model, Vertex normals are oriented toward velocity*/
|
||||||
|
#define CCD_BSB_AERO_VTWOSIDE 32 /* aero model, Vertex normals are flipped to match velocity */
|
||||||
|
|
||||||
|
/* BulletSoftBody.collisionflags */
|
||||||
|
#define CCD_BSB_COL_SDF_RS 2 /* SDF based rigid vs soft */
|
||||||
|
#define CCD_BSB_COL_CL_RS 4 /* Cluster based rigid vs soft */
|
||||||
|
#define CCD_BSB_COL_CL_SS 8 /* Cluster based soft vs soft */
|
||||||
|
#define CCD_BSB_COL_VF_SS 16 /* Vertex/Face based soft vs soft */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Shape contructor
|
// Shape contructor
|
||||||
// It contains all the information needed to create a simple bullet shape at runtime
|
// It contains all the information needed to create a simple bullet shape at runtime
|
||||||
class CcdShapeConstructionInfo
|
class CcdShapeConstructionInfo
|
||||||
@ -162,9 +176,6 @@ struct CcdConstructionInfo
|
|||||||
m_linearDamping(0.1f),
|
m_linearDamping(0.1f),
|
||||||
m_angularDamping(0.1f),
|
m_angularDamping(0.1f),
|
||||||
m_margin(0.06f),
|
m_margin(0.06f),
|
||||||
m_linearStiffness(1.f),
|
|
||||||
m_angularStiffness(1.f),
|
|
||||||
m_volumePreservation(1.f),
|
|
||||||
m_gamesoftFlag(0),
|
m_gamesoftFlag(0),
|
||||||
m_collisionFlags(0),
|
m_collisionFlags(0),
|
||||||
m_bRigid(false),
|
m_bRigid(false),
|
||||||
@ -189,10 +200,44 @@ struct CcdConstructionInfo
|
|||||||
btScalar m_angularDamping;
|
btScalar m_angularDamping;
|
||||||
btScalar m_margin;
|
btScalar m_margin;
|
||||||
|
|
||||||
btScalar m_linearStiffness;
|
////////////////////
|
||||||
btScalar m_angularStiffness;
|
int m_gamesoftFlag;
|
||||||
btScalar m_volumePreservation;
|
float m_soft_linStiff; /* linear stiffness 0..1 */
|
||||||
int m_gamesoftFlag;
|
float m_soft_angStiff; /* angular stiffness 0..1 */
|
||||||
|
float m_soft_volume; /* volume preservation 0..1 */
|
||||||
|
|
||||||
|
int m_soft_viterations; /* Velocities solver iterations */
|
||||||
|
int m_soft_piterations; /* Positions solver iterations */
|
||||||
|
int m_soft_diterations; /* Drift solver iterations */
|
||||||
|
int m_soft_citerations; /* Cluster solver iterations */
|
||||||
|
|
||||||
|
float m_soft_kSRHR_CL; /* Soft vs rigid hardness [0,1] (cluster only) */
|
||||||
|
float m_soft_kSKHR_CL; /* Soft vs kinetic hardness [0,1] (cluster only) */
|
||||||
|
float m_soft_kSSHR_CL; /* Soft vs soft hardness [0,1] (cluster only) */
|
||||||
|
float m_soft_kSR_SPLT_CL; /* Soft vs rigid impulse split [0,1] (cluster only) */
|
||||||
|
|
||||||
|
float m_soft_kSK_SPLT_CL; /* Soft vs rigid impulse split [0,1] (cluster only) */
|
||||||
|
float m_soft_kSS_SPLT_CL; /* Soft vs rigid impulse split [0,1] (cluster only) */
|
||||||
|
float m_soft_kVCF; /* Velocities correction factor (Baumgarte) */
|
||||||
|
float m_soft_kDP; /* Damping coefficient [0,1] */
|
||||||
|
|
||||||
|
float m_soft_kDG; /* Drag coefficient [0,+inf] */
|
||||||
|
float m_soft_kLF; /* Lift coefficient [0,+inf] */
|
||||||
|
float m_soft_kPR; /* Pressure coefficient [-inf,+inf] */
|
||||||
|
float m_soft_kVC; /* Volume conversation coefficient [0,+inf] */
|
||||||
|
|
||||||
|
float m_soft_kDF; /* Dynamic friction coefficient [0,1] */
|
||||||
|
float m_soft_kMT; /* Pose matching coefficient [0,1] */
|
||||||
|
float m_soft_kCHR; /* Rigid contacts hardness [0,1] */
|
||||||
|
float m_soft_kKHR; /* Kinetic contacts hardness [0,1] */
|
||||||
|
|
||||||
|
float m_soft_kSHR; /* Soft contacts hardness [0,1] */
|
||||||
|
float m_soft_kAHR; /* Anchors hardness [0,1] */
|
||||||
|
int m_soft_collisionflags; /* Vertex/Face or Signed Distance Field(SDF) or Clusters, Soft versus Soft or Rigid */
|
||||||
|
int m_soft_numclusteriterations; /* number of iterations to refine collision clusters*/
|
||||||
|
///////////////////
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int m_collisionFlags;
|
int m_collisionFlags;
|
||||||
bool m_bRigid;
|
bool m_bRigid;
|
||||||
|
@ -576,7 +576,8 @@ bool CcdPhysicsEnvironment::proceedDeltaTime(double curTime,float timeStep)
|
|||||||
veh->SyncWheels();
|
veh->SyncWheels();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_dynamicsWorld->debugDrawWorld();
|
if (m_dynamicsWorld->getDebugDrawer() && m_dynamicsWorld->getDebugDrawer()->getDebugMode() >0)
|
||||||
|
m_dynamicsWorld->debugDrawWorld();
|
||||||
|
|
||||||
|
|
||||||
CallbackTriggers();
|
CallbackTriggers();
|
||||||
|
Loading…
Reference in New Issue
Block a user