diff options
Diffstat (limited to 'modules/bullet/soft_body_bullet.cpp')
-rw-r--r-- | modules/bullet/soft_body_bullet.cpp | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/modules/bullet/soft_body_bullet.cpp b/modules/bullet/soft_body_bullet.cpp index ee48b3c5f0..6794d6c313 100644 --- a/modules/bullet/soft_body_bullet.cpp +++ b/modules/bullet/soft_body_bullet.cpp @@ -41,7 +41,7 @@ SoftBodyBullet::SoftBodyBullet() : SoftBodyBullet::~SoftBodyBullet() { } -void SoftBodyBullet::do_reload_body() { +void SoftBodyBullet::reload_body() { if (space) { space->remove_soft_body(this); space->add_soft_body(this); @@ -51,15 +51,13 @@ void SoftBodyBullet::do_reload_body() { void SoftBodyBullet::set_space(SpaceBullet *p_space) { if (space) { isScratched = false; - space->unregister_collision_object(this); space->remove_soft_body(this); } space = p_space; if (space) { - space->register_collision_object(this); - reload_body(); + space->add_soft_body(this); } } @@ -346,14 +344,14 @@ void SoftBodyBullet::set_trimesh_body_shape(Vector<int> p_indices, Vector<Vector indices_table.push_back(Vector<int>()); } - indices_table[vertex_id].push_back(vs_vertex_index); + indices_table.write[vertex_id].push_back(vs_vertex_index); vs_indices_to_physics_table.push_back(vertex_id); } } const int indices_map_size(indices_table.size()); - LocalVector<btScalar> bt_vertices; + Vector<btScalar> bt_vertices; { // Parse vertices to bullet @@ -361,13 +359,13 @@ void SoftBodyBullet::set_trimesh_body_shape(Vector<int> p_indices, Vector<Vector const Vector3 *p_vertices_read = p_vertices.ptr(); for (int i = 0; i < indices_map_size; ++i) { - bt_vertices[3 * i + 0] = p_vertices_read[indices_table[i][0]].x; - bt_vertices[3 * i + 1] = p_vertices_read[indices_table[i][0]].y; - bt_vertices[3 * i + 2] = p_vertices_read[indices_table[i][0]].z; + bt_vertices.write[3 * i + 0] = p_vertices_read[indices_table[i][0]].x; + bt_vertices.write[3 * i + 1] = p_vertices_read[indices_table[i][0]].y; + bt_vertices.write[3 * i + 2] = p_vertices_read[indices_table[i][0]].z; } } - LocalVector<int> bt_triangles; + Vector<int> bt_triangles; const int triangles_size(p_indices.size() / 3); { // Parse indices @@ -377,9 +375,9 @@ void SoftBodyBullet::set_trimesh_body_shape(Vector<int> p_indices, Vector<Vector const int *p_indices_read = p_indices.ptr(); for (int i = 0; i < triangles_size; ++i) { - bt_triangles[3 * i + 0] = vs_indices_to_physics_table[p_indices_read[3 * i + 2]]; - bt_triangles[3 * i + 1] = vs_indices_to_physics_table[p_indices_read[3 * i + 1]]; - bt_triangles[3 * i + 2] = vs_indices_to_physics_table[p_indices_read[3 * i + 0]]; + bt_triangles.write[3 * i + 0] = vs_indices_to_physics_table[p_indices_read[3 * i + 2]]; + bt_triangles.write[3 * i + 1] = vs_indices_to_physics_table[p_indices_read[3 * i + 1]]; + bt_triangles.write[3 * i + 2] = vs_indices_to_physics_table[p_indices_read[3 * i + 0]]; } } |