summaryrefslogtreecommitdiff
path: root/scene/3d
diff options
context:
space:
mode:
Diffstat (limited to 'scene/3d')
-rw-r--r--scene/3d/gpu_particles_collision_3d.cpp4
-rw-r--r--scene/3d/node_3d.cpp4
-rw-r--r--scene/3d/physics_joint_3d.cpp16
3 files changed, 13 insertions, 11 deletions
diff --git a/scene/3d/gpu_particles_collision_3d.cpp b/scene/3d/gpu_particles_collision_3d.cpp
index 145b5afbd0..97241be60f 100644
--- a/scene/3d/gpu_particles_collision_3d.cpp
+++ b/scene/3d/gpu_particles_collision_3d.cpp
@@ -293,11 +293,11 @@ void GPUParticlesCollisionSDF::_find_closest_distance(const Vector3 &p_pos, cons
SGN(cb.cross(nor).dot(pb)) +
SGN(ac.cross(nor).dot(pc)) <
2.0) ?
- MIN(MIN(
+ MIN(MIN(
Vector3_dot2(ba * CLAMP(ba.dot(pa) / Vector3_dot2(ba), 0.0, 1.0) - pa),
Vector3_dot2(cb * CLAMP(cb.dot(pb) / Vector3_dot2(cb), 0.0, 1.0) - pb)),
Vector3_dot2(ac * CLAMP(ac.dot(pc) / Vector3_dot2(ac), 0.0, 1.0) - pc)) :
- nor.dot(pa) * nor.dot(pa) / Vector3_dot2(nor));
+ nor.dot(pa) * nor.dot(pa) / Vector3_dot2(nor));
closest_distance = MIN(closest_distance, inside_d);
}
diff --git a/scene/3d/node_3d.cpp b/scene/3d/node_3d.cpp
index 503dd5735b..2a49e60669 100644
--- a/scene/3d/node_3d.cpp
+++ b/scene/3d/node_3d.cpp
@@ -239,8 +239,8 @@ void Node3D::set_transform(const Transform &p_transform) {
void Node3D::set_global_transform(const Transform &p_transform) {
Transform xform =
(data.parent && !data.top_level_active) ?
- data.parent->get_global_transform().affine_inverse() * p_transform :
- p_transform;
+ data.parent->get_global_transform().affine_inverse() * p_transform :
+ p_transform;
set_transform(xform);
}
diff --git a/scene/3d/physics_joint_3d.cpp b/scene/3d/physics_joint_3d.cpp
index 0a2af6b0cd..326b91b6ed 100644
--- a/scene/3d/physics_joint_3d.cpp
+++ b/scene/3d/physics_joint_3d.cpp
@@ -114,21 +114,23 @@ void Joint3D::_update_joint(bool p_only_free) {
return;
}
- if (!body_a) {
- SWAP(body_a, body_b);
- }
-
warning = String();
update_configuration_warning();
- joint = _configure_joint(body_a, body_b);
+ if (body_a) {
+ joint = _configure_joint(body_a, body_b);
+ } else if (body_b) {
+ joint = _configure_joint(body_b, nullptr);
+ }
ERR_FAIL_COND_MSG(!joint.is_valid(), "Failed to configure the joint.");
PhysicsServer3D::get_singleton()->joint_set_solver_priority(joint, solver_priority);
- ba = body_a->get_rid();
- body_a->connect(SceneStringNames::get_singleton()->tree_exiting, callable_mp(this, &Joint3D::_body_exit_tree), make_binds(body_a->get_instance_id()));
+ if (body_a) {
+ ba = body_a->get_rid();
+ body_a->connect(SceneStringNames::get_singleton()->tree_exiting, callable_mp(this, &Joint3D::_body_exit_tree), make_binds(body_a->get_instance_id()));
+ }
if (body_b) {
bb = body_b->get_rid();