Permalink
Browse files

FIX: rotation of the paddle done through the wheel

  • Loading branch information...
1 parent 4e222cb commit 9c9e456d6ff2124e6393d9a4ecae5375d2c27477 @gnuvince committed Jan 29, 2012
Showing with 28 additions and 33 deletions.
  1. +28 −33 Application/Sources/Scene/Boat.cpp
@@ -189,53 +189,49 @@ namespace Application
t.RotateY(0);
mHull.SetLocalTransformation(t);
-
if (MainWindow::Get()->IsKeyPressed('w')) {
Transformation<real> t = GetLocalTransformation();
t.Translate(Vector3<real>(cos(angle - PI/2)*-20*dt, 0, -sin(angle - PI/2)*-20*dt));
SetLocalTransformation(t);
- for (int i = 0; i < 5; ++i) {
- Transformation<real> t = mLeftPaddles[i].GetLocalTransformation();
- t.RotateY(dt*2);
- mLeftPaddles[i].SetLocalTransformation(t);
+ // Update wheels
+ t = mLeftWheel.GetLocalTransformation();
+ t.RotateX(-dt*2);
+ mLeftWheel.SetLocalTransformation(t);
- t = mRightPaddles[i].GetLocalTransformation();
- t.RotateY(dt*2);
- mRightPaddles[i].SetLocalTransformation(t);
- }
+ t = mRightWheel.GetLocalTransformation();
+ t.RotateX(-dt*2);
+ mRightWheel.SetLocalTransformation(t);
}
if (MainWindow::Get()->IsKeyPressed('s')) {
Transformation<real> t = GetLocalTransformation();
t.Translate(Vector3<real>(cos(angle - PI/2)*10*dt, 0, -sin(angle - PI/2)*10*dt));
SetLocalTransformation(t);
- for (int i = 0; i < 5; ++i) {
- Transformation<real> t = mLeftPaddles[i].GetLocalTransformation();
- t.RotateY(-dt*2);
- mLeftPaddles[i].SetLocalTransformation(t);
+ // Update wheels
+ t = mLeftWheel.GetLocalTransformation();
+ t.RotateX(dt*2);
+ mLeftWheel.SetLocalTransformation(t);
- t = mRightPaddles[i].GetLocalTransformation();
- t.RotateY(-dt*2);
- mRightPaddles[i].SetLocalTransformation(t);
- }
+ t = mRightWheel.GetLocalTransformation();
+ t.RotateX(dt*2);
+ mRightWheel.SetLocalTransformation(t);
}
if (MainWindow::Get()->IsKeyPressed('a')) {
Transformation<real> t = GetLocalTransformation();
t.RotateY(dt);
SetLocalTransformation(t);
- for (int i = 0; i < 5; ++i) {
- Transformation<real> t = mLeftPaddles[i].GetLocalTransformation();
- t.RotateY(dt);
- mLeftPaddles[i].SetLocalTransformation(t);
+ // Update wheels
+ t = mLeftWheel.GetLocalTransformation();
+ t.RotateX(-dt);
+ mLeftWheel.SetLocalTransformation(t);
- t = mRightPaddles[i].GetLocalTransformation();
- t.RotateY(-dt);
- mRightPaddles[i].SetLocalTransformation(t);
- }
+ t = mRightWheel.GetLocalTransformation();
+ t.RotateX(dt);
+ mRightWheel.SetLocalTransformation(t);
angle += dt;
}
@@ -245,15 +241,14 @@ namespace Application
t.RotateY(-dt);
SetLocalTransformation(t);
- for (int i = 0; i < 5; ++i) {
- Transformation<real> t = mLeftPaddles[i].GetLocalTransformation();
- t.RotateY(-dt);
- mLeftPaddles[i].SetLocalTransformation(t);
+ // Update wheels
+ t = mLeftWheel.GetLocalTransformation();
+ t.RotateX(dt);
+ mLeftWheel.SetLocalTransformation(t);
- t = mRightPaddles[i].GetLocalTransformation();
- t.RotateY(dt);
- mRightPaddles[i].SetLocalTransformation(t);
- }
+ t = mRightWheel.GetLocalTransformation();
+ t.RotateX(-dt);
+ mRightWheel.SetLocalTransformation(t);
angle -= dt;
}

0 comments on commit 9c9e456

Please sign in to comment.