Merge pull request #32865 from rodolforg/fix_32711-lookat-scaling-again

Spatial::look_at wrong re-scaling
This commit is contained in:
Rémi Verschelde 2019-10-21 16:05:21 +02:00 committed by GitHub
commit 4a726998bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 3 deletions

View File

@ -690,11 +690,10 @@ void Spatial::look_at_from_position(const Vector3 &p_pos, const Vector3 &p_targe
Transform lookat; Transform lookat;
lookat.origin = p_pos; 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); 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_global_transform(lookat);
set_scale(original_scale);
} }
Vector3 Spatial::to_local(Vector3 p_global) const { Vector3 Spatial::to_local(Vector3 p_global) const {