浏览代码

fix #32711 : Spatial::look_at wrong re-scaling

Rodolfo Ribeiro Gomes 5 年之前
父节点
当前提交
58e5c650d7
共有 1 个文件被更改,包括 2 次插入3 次删除
  1. 2 3
      scene/3d/spatial.cpp

+ 2 - 3
scene/3d/spatial.cpp

@@ -690,11 +690,10 @@ void Spatial::look_at_from_position(const Vector3 &p_pos, const Vector3 &p_targe
 	Transform lookat;
 	lookat.origin = p_pos;
 
-	Vector3 original_scale(get_global_transform().basis.get_scale());
+	Vector3 original_scale(get_scale());
 	lookat = lookat.looking_at(p_target, p_up);
-	// as basis was normalized, we just need to apply original scale back
-	lookat.basis.scale(original_scale);
 	set_global_transform(lookat);
+	set_scale(original_scale);
 }
 
 Vector3 Spatial::to_local(Vector3 p_global) const {