mirror of
https://github.com/Relintai/voxelman.git
synced 2024-11-14 10:17:20 +01:00
Update MeshDataResource offsets, as now they are Transforms.
This commit is contained in:
parent
a4b5400a4e
commit
138614f743
@ -907,8 +907,7 @@ void VoxelChunkDefault::draw_debug_mdr_colliders() {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
Transform t = get_mesh_data_resource_transform(i);
|
Transform t = get_mesh_data_resource_transform(i);
|
||||||
Vector3 offset = mdr->get_collision_shape_offset(i);
|
Transform offset = mdr->get_collision_shape_offset(i);
|
||||||
t.origin += offset;
|
|
||||||
|
|
||||||
for (int j = 0; j < mdr->get_collision_shape_count(); ++j) {
|
for (int j = 0; j < mdr->get_collision_shape_count(); ++j) {
|
||||||
Ref<Shape> shape = mdr->get_collision_shape(j);
|
Ref<Shape> shape = mdr->get_collision_shape(j);
|
||||||
@ -916,7 +915,7 @@ void VoxelChunkDefault::draw_debug_mdr_colliders() {
|
|||||||
if (!shape.is_valid())
|
if (!shape.is_valid())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
shape->add_vertices_to_array(_debug_mesh_array, t);
|
shape->add_vertices_to_array(_debug_mesh_array, t * offset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1747,7 +1746,7 @@ void VoxelChunkDefault::_build_phase_physics_process(int phase) {
|
|||||||
|
|
||||||
for (int i = 0; i < get_mesh_data_resource_count(); ++i) {
|
for (int i = 0; i < get_mesh_data_resource_count(); ++i) {
|
||||||
Ref<MeshDataResource> mdr = get_mesh_data_resource(i);
|
Ref<MeshDataResource> mdr = get_mesh_data_resource(i);
|
||||||
Vector3 offset = mdr->get_collision_shape_offset(i);
|
Transform offset = mdr->get_collision_shape_offset(i);
|
||||||
|
|
||||||
for (int j = 0; j < mdr->get_collision_shape_count(); ++j) {
|
for (int j = 0; j < mdr->get_collision_shape_count(); ++j) {
|
||||||
Ref<Shape> shape = mdr->get_collision_shape(j);
|
Ref<Shape> shape = mdr->get_collision_shape(j);
|
||||||
@ -1762,7 +1761,7 @@ void VoxelChunkDefault::_build_phase_physics_process(int phase) {
|
|||||||
|
|
||||||
c.body = body;
|
c.body = body;
|
||||||
c.transform = get_mesh_data_resource_transform(i);
|
c.transform = get_mesh_data_resource_transform(i);
|
||||||
c.transform.origin += offset;
|
c.transform *= offset;
|
||||||
|
|
||||||
PhysicsServer::get_singleton()->body_add_shape(body, shape->get_rid());
|
PhysicsServer::get_singleton()->body_add_shape(body, shape->get_rid());
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user