mirror of
https://github.com/Relintai/mesh_data_resource.git
synced 2025-02-20 17:14:31 +01:00
Fix box, cylinder, capsule offsets.
This commit is contained in:
parent
5f8ab950b1
commit
25e9135925
@ -152,7 +152,10 @@ Error EditorImportColladaMdr::import(const String &p_source_file, const String &
|
||||
|
||||
shape->set_extents(size * 0.5);
|
||||
|
||||
mdr->add_collision_shape(aabb.position, shape);
|
||||
Vector3 pos = aabb.position;
|
||||
pos += size / 2.0;
|
||||
|
||||
mdr->add_collision_shape(pos, shape);
|
||||
} else if (collider_type == MeshDataResource::COLLIDER_TYPE_APPROXIMATED_CAPSULE) {
|
||||
Ref<ArrayMesh> m;
|
||||
m.instance();
|
||||
@ -167,7 +170,10 @@ Error EditorImportColladaMdr::import(const String &p_source_file, const String &
|
||||
shape->set_height(size.y * 0.5);
|
||||
shape->set_radius(MIN(size.x, size.z) * 0.5);
|
||||
|
||||
mdr->add_collision_shape(aabb.position, shape);
|
||||
Vector3 pos = aabb.position;
|
||||
pos += size / 2.0;
|
||||
|
||||
mdr->add_collision_shape(pos, shape);
|
||||
} else if (collider_type == MeshDataResource::COLLIDER_TYPE_APPROXIMATED_CYLINDER) {
|
||||
Ref<ArrayMesh> m;
|
||||
m.instance();
|
||||
@ -182,7 +188,10 @@ Error EditorImportColladaMdr::import(const String &p_source_file, const String &
|
||||
shape->set_height(size.y * 0.5);
|
||||
shape->set_radius(MIN(size.x, size.z) * 0.5);
|
||||
|
||||
mdr->add_collision_shape(aabb.position, shape);
|
||||
Vector3 pos = aabb.position;
|
||||
pos += size / 2.0;
|
||||
|
||||
mdr->add_collision_shape(pos, shape);
|
||||
} else if (collider_type == MeshDataResource::COLLIDER_TYPE_APPROXIMATED_SPHERE) {
|
||||
Ref<ArrayMesh> m;
|
||||
m.instance();
|
||||
|
@ -154,7 +154,10 @@ Error EditorImportGLTFMdr::import(const String &p_source_file, const String &p_s
|
||||
|
||||
shape->set_extents(size * 0.5);
|
||||
|
||||
mdr->add_collision_shape(aabb.position, shape);
|
||||
Vector3 pos = aabb.position;
|
||||
pos += size / 2.0;
|
||||
|
||||
mdr->add_collision_shape(pos, shape);
|
||||
} else if (collider_type == MeshDataResource::COLLIDER_TYPE_APPROXIMATED_CAPSULE) {
|
||||
Ref<ArrayMesh> m;
|
||||
m.instance();
|
||||
@ -169,7 +172,10 @@ Error EditorImportGLTFMdr::import(const String &p_source_file, const String &p_s
|
||||
shape->set_height(size.y * 0.5);
|
||||
shape->set_radius(MIN(size.x, size.z) * 0.5);
|
||||
|
||||
mdr->add_collision_shape(aabb.position, shape);
|
||||
Vector3 pos = aabb.position;
|
||||
pos += size / 2.0;
|
||||
|
||||
mdr->add_collision_shape(pos, shape);
|
||||
} else if (collider_type == MeshDataResource::COLLIDER_TYPE_APPROXIMATED_CYLINDER) {
|
||||
Ref<ArrayMesh> m;
|
||||
m.instance();
|
||||
@ -184,7 +190,10 @@ Error EditorImportGLTFMdr::import(const String &p_source_file, const String &p_s
|
||||
shape->set_height(size.y * 0.5);
|
||||
shape->set_radius(MIN(size.x, size.z) * 0.5);
|
||||
|
||||
mdr->add_collision_shape(aabb.position, shape);
|
||||
Vector3 pos = aabb.position;
|
||||
pos += size / 2.0;
|
||||
|
||||
mdr->add_collision_shape(pos, shape);
|
||||
} else if (collider_type == MeshDataResource::COLLIDER_TYPE_APPROXIMATED_SPHERE) {
|
||||
Ref<ArrayMesh> m;
|
||||
m.instance();
|
||||
|
Loading…
Reference in New Issue
Block a user