mirror of
https://github.com/godotengine/godot.git
synced 2026-01-03 18:11:19 +03:00
Fix broken negative scaling when using Jolt Physics
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
#include "jolt_area_3d.h"
|
||||
|
||||
#include "../jolt_project_settings.h"
|
||||
#include "../misc/jolt_math_funcs.h"
|
||||
#include "../misc/jolt_type_conversions.h"
|
||||
#include "../shapes/jolt_shape_3d.h"
|
||||
#include "../spaces/jolt_broad_phase_layer.h"
|
||||
@@ -370,7 +371,8 @@ void JoltArea3D::set_default_area(bool p_value) {
|
||||
void JoltArea3D::set_transform(Transform3D p_transform) {
|
||||
JOLT_ENSURE_SCALE_NOT_ZERO(p_transform, vformat("An invalid transform was passed to area '%s'.", to_string()));
|
||||
|
||||
const Vector3 new_scale = p_transform.basis.get_scale();
|
||||
Vector3 new_scale;
|
||||
JoltMath::decompose(p_transform, new_scale);
|
||||
|
||||
// Ideally we would do an exact comparison here, but due to floating-point precision this would be invalidated very often.
|
||||
if (!scale.is_equal_approx(new_scale)) {
|
||||
@@ -378,8 +380,6 @@ void JoltArea3D::set_transform(Transform3D p_transform) {
|
||||
_shapes_changed();
|
||||
}
|
||||
|
||||
p_transform.basis.orthonormalize();
|
||||
|
||||
if (!in_space()) {
|
||||
jolt_settings->mPosition = to_jolt_r(p_transform.origin);
|
||||
jolt_settings->mRotation = to_jolt(p_transform.basis);
|
||||
|
||||
Reference in New Issue
Block a user