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