diff options
| author | Juan Linietsky | 2015-04-18 14:19:33 -0300 |
|---|---|---|
| committer | Juan Linietsky | 2015-04-18 14:19:33 -0300 |
| commit | 6b3cd13c8d35af9ecdc2e2e14ce71ee0c3d53e0b (patch) | |
| tree | 37fc3af74b2d2a8108f22b449848ec2bc2a2b59e /core/math/vector3.cpp | |
| parent | 2592f0da9f8ab6ed2ad1b1d287d3aaa420f313b1 (diff) | |
| download | godot-6b3cd13c8d35af9ecdc2e2e14ce71ee0c3d53e0b.tar.gz godot-6b3cd13c8d35af9ecdc2e2e14ce71ee0c3d53e0b.tar.zst godot-6b3cd13c8d35af9ecdc2e2e14ce71ee0c3d53e0b.zip | |
Diffstat (limited to 'core/math/vector3.cpp')
| -rw-r--r-- | core/math/vector3.cpp | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/core/math/vector3.cpp b/core/math/vector3.cpp index cf6fd9242..0928a09b2 100644 --- a/core/math/vector3.cpp +++ b/core/math/vector3.cpp @@ -27,27 +27,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "vector3.h" - +#include "matrix3.h" void Vector3::rotate(const Vector3& p_axis,float p_phi) { - Vector3 axis1 = cross(p_axis); - float l = axis1.length(); - if (l==0) - return; - axis1/=l; - Vector3 axis2 = axis1.cross(p_axis).normalized(); - - float _x = axis1.dot(*this); - float _y = axis2.dot(*this); - - float ang = Math::atan2(_x,_y); - - ang+=p_phi; - - *this=((axis1 * Math::cos(ang)) + (axis2 * Math::sin(ang))) * length(); - + *this=Matrix3(p_axis,p_phi).xform(*this); } Vector3 Vector3::rotated(const Vector3& p_axis,float p_phi) const { |
