diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2011-06-13 21:08:33 +0400 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2011-06-13 21:08:33 +0400 |
commit | a2dda7c74d74770aeceb37924a1ef8e0d90ae57b (patch) | |
tree | dfd626cd66926c0661e4b704db1f81b76c016b9f /source/gameengine/Ketsji | |
parent | 0af94b45e4220b213df3d344c71abc47abdd4612 (diff) |
BGE Patch: [#27425] Allow to change the damping of the camera actuator
##########
original name: "Allow to change the strenght of the "go behind" constraint of the camera actuator"
The camera actuator is an actuator that drive the camera to follow an object, with a set of constraint.
Currently, when the object followed rotate on himself (like a person, or an helicopter), the camera is really slow to go behind (at least 10 seconds).
This patch gives the UI to tweak the strenght of the 'go behind'[named damping] constraint.
###########
epydocs (rst) updated too
Diffstat (limited to 'source/gameengine/Ketsji')
-rw-r--r-- | source/gameengine/Ketsji/KX_CameraActuator.cpp | 9 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_CameraActuator.h | 6 |
2 files changed, 11 insertions, 4 deletions
diff --git a/source/gameengine/Ketsji/KX_CameraActuator.cpp b/source/gameengine/Ketsji/KX_CameraActuator.cpp index d68cb453fe8..ebb291b2284 100644 --- a/source/gameengine/Ketsji/KX_CameraActuator.cpp +++ b/source/gameengine/Ketsji/KX_CameraActuator.cpp @@ -54,14 +54,16 @@ KX_CameraActuator::KX_CameraActuator( float hght, float minhght, float maxhght, - bool xytog + bool xytog, + float damping ): SCA_IActuator(gameobj, KX_ACT_CAMERA), m_ob (obj), m_height (hght), m_minHeight (minhght), m_maxHeight (maxhght), - m_x (xytog) + m_x (xytog), + m_damping (damping) { if (m_ob) m_ob->RegisterActuator(this); @@ -283,7 +285,7 @@ bool KX_CameraActuator::Update(double curtime, bool frame) } inp= fp1[0]*fp2[0] + fp1[1]*fp2[1] + fp1[2]*fp2[2]; - fac= (-1.0 + inp)/32.0; + fac= (-1.0 + inp) * m_damping; from[0]+= fac*fp1[0]; from[1]+= fac*fp1[1]; @@ -390,6 +392,7 @@ PyAttributeDef KX_CameraActuator::Attributes[] = { KX_PYATTRIBUTE_FLOAT_RW("height",-FLT_MAX,FLT_MAX,KX_CameraActuator,m_height), KX_PYATTRIBUTE_BOOL_RW("useXY",KX_CameraActuator,m_x), KX_PYATTRIBUTE_RW_FUNCTION("object", KX_CameraActuator, pyattr_get_object, pyattr_set_object), + KX_PYATTRIBUTE_FLOAT_RW("damping",0.f,10.f,KX_CameraActuator,m_damping), {NULL} }; diff --git a/source/gameengine/Ketsji/KX_CameraActuator.h b/source/gameengine/Ketsji/KX_CameraActuator.h index d59fcff9370..f844f6418b8 100644 --- a/source/gameengine/Ketsji/KX_CameraActuator.h +++ b/source/gameengine/Ketsji/KX_CameraActuator.h @@ -73,6 +73,9 @@ private : /** xy toggle (pick one): true == x, false == y */ bool m_x; + + /** damping (float), */ + float m_damping; /* get the KX_IGameObject with this name */ CValue *findObject(char *obName); @@ -95,7 +98,8 @@ private : float hght, float minhght, float maxhght, - bool xytog + bool xytog, + float damping ); |