add compute softbody com
This commit is contained in:
@@ -7257,6 +7257,7 @@ bool PhysicsServerCommandProcessor::processRequestActualStateCommand(const struc
|
||||
serverCmd.m_numDataStreamBytes = sizeof(SendActualStateSharedMemoryStorage);
|
||||
serverCmd.m_sendActualStateArgs.m_stateDetails = 0;
|
||||
|
||||
|
||||
serverCmd.m_sendActualStateArgs.m_rootLocalInertialFrame[0] =
|
||||
body->m_rootLocalInertialFrame.getOrigin()[0];
|
||||
serverCmd.m_sendActualStateArgs.m_rootLocalInertialFrame[1] =
|
||||
@@ -7273,11 +7274,12 @@ bool PhysicsServerCommandProcessor::processRequestActualStateCommand(const struc
|
||||
serverCmd.m_sendActualStateArgs.m_rootLocalInertialFrame[6] =
|
||||
body->m_rootLocalInertialFrame.getRotation()[3];
|
||||
|
||||
btVector3 center_of_mass(sb->getCenterOfMass());
|
||||
btTransform tr = sb->getWorldTransform();
|
||||
//base position in world space, cartesian
|
||||
stateDetails->m_actualStateQ[0] = tr.getOrigin()[0];
|
||||
stateDetails->m_actualStateQ[1] = tr.getOrigin()[1];
|
||||
stateDetails->m_actualStateQ[2] = tr.getOrigin()[2];
|
||||
stateDetails->m_actualStateQ[0] = center_of_mass[0];
|
||||
stateDetails->m_actualStateQ[1] = center_of_mass[1];
|
||||
stateDetails->m_actualStateQ[2] = center_of_mass[2];
|
||||
|
||||
//base orientation, quaternion x,y,z,w, in world space, cartesian
|
||||
stateDetails->m_actualStateQ[3] = tr.getRotation()[0];
|
||||
|
||||
@@ -20,6 +20,7 @@ subject to the following restrictions:
|
||||
#include "LinearMath/btAlignedObjectArray.h"
|
||||
#include "LinearMath/btTransform.h"
|
||||
#include "LinearMath/btIDebugDraw.h"
|
||||
#include "LinearMath/btVector3.h"
|
||||
#include "BulletDynamics/Dynamics/btRigidBody.h"
|
||||
|
||||
#include "BulletCollision/CollisionShapes/btConcaveShape.h"
|
||||
@@ -973,6 +974,14 @@ public:
|
||||
/* Return the volume */
|
||||
btScalar getVolume() const;
|
||||
/* Cluster count */
|
||||
btVector3 getCenterOfMass() const{
|
||||
btVector3 com(0,0,0);
|
||||
for(int i = 0; i<m_nodes.size(); i++){
|
||||
com += m_nodes[i].m_x;
|
||||
}
|
||||
com/=m_nodes.size();
|
||||
return com;
|
||||
}
|
||||
int clusterCount() const;
|
||||
/* Cluster center of mass */
|
||||
static btVector3 clusterCom(const Cluster* cluster);
|
||||
|
||||
Reference in New Issue
Block a user