Fixed wiimote steering (steering was dependend on

roll, i.e. tilting the wiimote forward would affect
steering), #990.


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@14301 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2013-10-24 20:55:33 +00:00
parent effc7049a2
commit b51f500f8f

View File

@ -76,24 +76,26 @@ void Wiimote::resetIrrEvent()
*/
void Wiimote::update()
{
float normalized_angle = -(m_wiimote_handle->accel.y-128)
/ UserConfigParams::m_wiimote_max;
#ifdef DEBUG
if(UserConfigParams::m_wiimote_debug)
{
Log::verbose("wiimote", "pitch: %f yaw %f roll %f",
m_wiimote_handle->orient.pitch,
m_wiimote_handle->orient.yaw,
m_wiimote_handle->orient.roll);
Log::verbose("wiimote", "xyz %d %d %d %f",
m_wiimote_handle->accel.x,
m_wiimote_handle->accel.y,
m_wiimote_handle->accel.z,
normalized_angle);
}
#endif
float normalized_angle = -m_wiimote_handle->orient.pitch / UserConfigParams::m_wiimote_max;
if(normalized_angle<-1.0f)
normalized_angle = -1.0f;
else if(normalized_angle>1.0f)
normalized_angle = 1.0f;
// Shape the curve that determines steering depending on wiimote angle.
// The wiimote value is already normalized to be in [-1,1]. Now use a
// Shape the curve that determines steering depending on wiimote angle.
// The wiimote value is already normalized to be in [-1,1]. Now use a
// weighted linear combination to compute the steering value used in game.
float w1 = UserConfigParams::m_wiimote_weight_linear;
float w2 = UserConfigParams::m_wiimote_weight_square;