diff options
author | Chuyuan Kelly Fu <fuchuyuan@google.com> | 2022-02-13 21:16:24 -0800 |
---|---|---|
committer | Chuyuan Kelly Fu <fuchuyuan@google.com> | 2022-02-18 17:47:54 -0800 |
commit | 236d39d2ec20be7ffe68d21b632eb5e845d77a89 (patch) | |
tree | cbd119278c369ad33fc3de6723104e28e4bc0bae | |
parent | 07de08a38e0f94332017982185be3d526b9fe3c5 (diff) | |
download | bullet3-236d39d2ec20be7ffe68d21b632eb5e845d77a89.tar.gz |
reset deformable velocity
-rw-r--r-- | examples/SharedMemory/PhysicsServerCommandProcessor.cpp | 19 | ||||
-rw-r--r-- | examples/SharedMemory/SharedMemoryPublic.h | 2 |
2 files changed, 16 insertions, 5 deletions
diff --git a/examples/SharedMemory/PhysicsServerCommandProcessor.cpp b/examples/SharedMemory/PhysicsServerCommandProcessor.cpp index 9f1c7b98a..2506a767f 100644 --- a/examples/SharedMemory/PhysicsServerCommandProcessor.cpp +++ b/examples/SharedMemory/PhysicsServerCommandProcessor.cpp @@ -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]); - } - serverStatusOut.m_type = CMD_RESET_MESH_DATA_COMPLETED; - } + 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]); + } + } + 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 } diff --git a/examples/SharedMemory/SharedMemoryPublic.h b/examples/SharedMemory/SharedMemoryPublic.h index b1a560339..90143b55e 100644 --- a/examples/SharedMemory/SharedMemoryPublic.h +++ b/examples/SharedMemory/SharedMemoryPublic.h @@ -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 |