reset deformable velocity

This commit is contained in:
Chuyuan Kelly Fu 2022-02-13 21:16:24 -08:00
parent 07de08a38e
commit 236d39d2ec
2 changed files with 15 additions and 4 deletions

View File

@ -5512,13 +5512,24 @@ bool PhysicsServerCommandProcessor::processResetMeshDataCommand(const struct Sha
int numVertices = psb->m_nodes.size();
if (clientCmd.m_resetMeshDataArgs.m_numVertices == numVertices)
{
if(clientCmd.m_updateFlags & B3_MESH_DATA_SIMULATION_MESH_VELOCITY){
for (int i = 0; i < numVertices; ++i)
{
btSoftBody::Node& n = psb->m_nodes[i];
n.m_x.setValue(vertexUpload[i*3+0], vertexUpload[i*3+1],vertexUpload[i*3+2]);
n.m_v.setValue(vertexUpload[i*3+0], vertexUpload[i*3+1],vertexUpload[i*3+2]);
n.m_vn.setValue(vertexUpload[i*3+0], vertexUpload[i*3+1],vertexUpload[i*3+2]);
}
serverStatusOut.m_type = CMD_RESET_MESH_DATA_COMPLETED;
}
}
else{
for (int i = 0; i < numVertices; ++i)
{
btSoftBody::Node& n = psb->m_nodes[i];
n.m_x.setValue(vertexUpload[i*3+0], vertexUpload[i*3+1],vertexUpload[i*3+2]);
n.m_q.setValue(vertexUpload[i*3+0], vertexUpload[i*3+1],vertexUpload[i*3+2]);
}
}
serverStatusOut.m_type = CMD_RESET_MESH_DATA_COMPLETED;
}
}
#endif //SKIP_SOFT_BODY_MULTI_BODY_DYNAMICS_WORLD
}

View File

@ -467,7 +467,7 @@ enum eMeshDataFlags
B3_MESH_DATA_SIMULATION_MESH=1,
B3_MESH_DATA_SIMULATION_INDICES=2,
B3_MESH_DATA_GRAPHICS_INDICES=4,
B3_MESH_DATA_SIMULATION_MESH_VELOCITY=8,
B3_MESH_DATA_SIMULATION_MESH_VELOCITY=8,
};
enum eMeshDataEnum