diff options
author | Benoit Bolsee <benoit.bolsee@online.be> | 2008-06-19 01:22:17 +0400 |
---|---|---|
committer | Benoit Bolsee <benoit.bolsee@online.be> | 2008-06-19 01:22:17 +0400 |
commit | df8a3882c6dbaa201c586419d9720162c4805fdf (patch) | |
tree | 1a0bf5fa94ffcbd196aa02d4c73d9a6bbc8f4892 /source/gameengine/Ketsji/KX_GameObject.cpp | |
parent | fd8e873e012072011846b34a233d149ca5d3bb80 (diff) |
BGE patch #13625: getLinearVelocity() rewrite to use only vector and matrix operations
Diffstat (limited to 'source/gameengine/Ketsji/KX_GameObject.cpp')
-rw-r--r-- | source/gameengine/Ketsji/KX_GameObject.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index 88b936aafd5..eaa6564ba84 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -646,8 +646,8 @@ void KX_GameObject::AlignAxisToVect(const MT_Vector3& dir, int axis) MT_Vector3 KX_GameObject::GetLinearVelocity(bool local) { - MT_Vector3 velocity(0.0,0.0,0.0); - MT_Matrix3x3 ori, locvel; + MT_Vector3 velocity(0.0,0.0,0.0), locvel; + MT_Matrix3x3 ori; int i, j; if (m_pPhysicsController1) { @@ -657,11 +657,8 @@ MT_Vector3 KX_GameObject::GetLinearVelocity(bool local) { ori = GetSGNode()->GetWorldOrientation(); - for(i=0; i < 3; i++) - for(j=0; j < 3; j++) - locvel[i][j]= velocity[i]*ori[i][j]; - for(i=0; i < 3; i++) - velocity[i] = locvel[0][i] + locvel[1][i] + locvel[2][i]; + locvel = velocity * ori; + return locvel; } } return velocity; |