Revert part of D1074 related to acceleration taked into account.
authorJorge Bernal <jbernalmartinez@gmail.com>
Sat, 21 Mar 2015 16:53:18 +0000 (17:53 +0100)
committerJorge Bernal <jbernalmartinez@gmail.com>
Sat, 21 Mar 2015 16:54:49 +0000 (17:54 +0100)
It has been reverted because it was affecting obstacle avoidance
(T44041).

This fix should be backported to 2.74

source/blender/blenloader/intern/versioning_270.c
source/gameengine/Ketsji/KX_SteeringActuator.cpp

index ee015fa5652d565c658337e287da512d9982ca1e..adf5f93ae1632a69e4923c945fd847ac15be5bcf 100644 (file)
@@ -616,18 +616,6 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
                                }
                        }
                }
-
-               if (!DNA_struct_elem_find(fd->filesdna, "bSteeringActuator", "float", "acceleration")) {
-                       for (ob = main->object.first; ob; ob = ob->id.next) {
-                               bActuator *act;
-                               for (act = ob->actuators.first; act; act = act->next) {
-                                       if (act->type == ACT_STEERING) {
-                                               bSteeringActuator *sact = act->data;
-                                               sact->acceleration = 1000.f;
-                                       }
-                               }
-                       }
-               }
        }
 
        if (!MAIN_VERSION_ATLEAST(main, 273, 9)) {
index f859b1ceae98947faf9ca9c7c8d5655f20c280ef..83597f9125a97e39dc3ef8b93824ef8df367913b 100644 (file)
@@ -263,12 +263,12 @@ bool KX_SteeringActuator::Update(double curtime, bool frame)
 
                if (apply_steerforce)
                {
-                       MT_Vector3 newvel;
                        bool isdyna = obj->IsDynamic();
                        if (isdyna)
                                m_steerVec.z() = 0;
                        if (!m_steerVec.fuzzyZero())
                                m_steerVec.normalize();
+                       MT_Vector3 newvel = m_velocity * m_steerVec;
 
                        //adjust velocity to avoid obstacles
                        if (m_simulation && m_obstacle /*&& !newvel.fuzzyZero()*/)
@@ -281,16 +281,13 @@ bool KX_SteeringActuator::Update(double curtime, bool frame)
                                        KX_RasterizerDrawDebugLine(mypos, mypos + newvel, MT_Vector3(0.0, 1.0, 0.0));
                        }
 
-                       HandleActorFace(m_steerVec);
+                       HandleActorFace(newvel);
                        if (isdyna)
                        {
-                               //TODO: Take into account angular velocity on turns
+                               //temporary solution: set 2D steering velocity directly to obj
+                               //correct way is to apply physical force
                                MT_Vector3 curvel = obj->GetLinearVelocity();
 
-                               newvel = (curvel.length() * m_steerVec) + (m_acceleration * delta) * m_steerVec;
-                               if (newvel.length2() >= (m_velocity * m_velocity))
-                                       newvel = m_velocity * m_steerVec;
-
                                if (m_lockzvel)
                                        newvel.z() = 0.0f;
                                else