mirror of
https://github.com/bulletphysics/bullet3.git
synced 2026-10-24 01:30:54 +00:00
Add support for picking deformable with mouse
This commit is contained in:
@@ -22,18 +22,17 @@
|
||||
#include "BulletDynamics/Featherstone/btMultiBodyConstraintSolver.h"
|
||||
#include <stdio.h> //printf debugging
|
||||
|
||||
#include "../CommonInterfaces/CommonRigidBodyBase.h"
|
||||
#include "../CommonInterfaces/CommonDeformableBodyBase.h"
|
||||
#include "../Utils/b3ResourcePath.h"
|
||||
|
||||
///The ClothFriction shows the use of deformable friction.
|
||||
class ClothFriction : public CommonRigidBodyBase
|
||||
class ClothFriction : public CommonDeformableBodyBase
|
||||
{
|
||||
btAlignedObjectArray<btDeformableLagrangianForce*> m_forces;
|
||||
btDeformableBodySolver* m_deformableBodySolver;
|
||||
public:
|
||||
ClothFriction(struct GUIHelperInterface* helper)
|
||||
: CommonRigidBodyBase(helper),
|
||||
m_deformableBodySolver(0)
|
||||
: CommonDeformableBodyBase(helper),
|
||||
m_deformableBodySolver(0)
|
||||
{
|
||||
}
|
||||
virtual ~ClothFriction()
|
||||
@@ -59,19 +58,9 @@ public:
|
||||
m_dynamicsWorld->stepSimulation(deltaTime, 4, internalTimeStep);
|
||||
}
|
||||
|
||||
virtual const btDeformableMultiBodyDynamicsWorld* getDeformableDynamicsWorld() const
|
||||
{
|
||||
return (btDeformableMultiBodyDynamicsWorld*)m_dynamicsWorld;
|
||||
}
|
||||
|
||||
virtual btDeformableMultiBodyDynamicsWorld* getDeformableDynamicsWorld()
|
||||
{
|
||||
return (btDeformableMultiBodyDynamicsWorld*)m_dynamicsWorld;
|
||||
}
|
||||
|
||||
virtual void renderScene()
|
||||
{
|
||||
CommonRigidBodyBase::renderScene();
|
||||
CommonDeformableBodyBase::renderScene();
|
||||
btDeformableMultiBodyDynamicsWorld* deformableWorld = getDeformableDynamicsWorld();
|
||||
|
||||
for (int i = 0; i < deformableWorld->getSoftBodyArray().size(); i++)
|
||||
@@ -210,7 +199,7 @@ void ClothFriction::initPhysics()
|
||||
void ClothFriction::exitPhysics()
|
||||
{
|
||||
//cleanup in the reverse order of creation/initialization
|
||||
|
||||
removePickingConstraint();
|
||||
//remove the rigidbodies from the dynamics world and delete them
|
||||
int i;
|
||||
for (i = m_dynamicsWorld->getNumCollisionObjects() - 1; i >= 0; i--)
|
||||
|
||||
Reference in New Issue
Block a user