public:t-gede-14-1:lab5
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| public:t-gede-14-1:lab5 [2014/02/16 15:25] – [Bonus points] marino | public:t-gede-14-1:lab5 [2024/04/29 13:33] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 13: | Line 13: | ||
| ===== Preparation ===== | ===== Preparation ===== | ||
| - | No special preparation is required - preparing the joypad is explained in the project steps below. | + | No special preparation is required - preparing the joypad is explained in the project steps below. You do not have to use the latest lab as a base for this one, you can use the base of lab2 or any other **//except lab1//** if you feel like the project has become to bloated. |
| **NOTE:** To get the joypads to start sending data, you may have to press a **Mode** button in the center of the device. This is true for the joypads handed out in the lab class! | **NOTE:** To get the joypads to start sending data, you may have to press a **Mode** button in the center of the device. This is true for the joypads handed out in the lab class! | ||
| + | |||
| + | |||
| ===== Lab Project ===== | ===== Lab Project ===== | ||
| Line 121: | Line 123: | ||
| ====== Bonus points ====== | ====== Bonus points ====== | ||
| <box green 100% | Bonus points> | <box green 100% | Bonus points> | ||
| - | - **Make the input a little | + | - **Make the input a little |
| - **Remove the code** from frameStarted: | - **Remove the code** from frameStarted: | ||
| Ogre:: | Ogre:: | ||
| Line 165: | Line 167: | ||
| // Add these lines, dont forget to break :) | // Add these lines, dont forget to break :) | ||
| case 2: | case 2: | ||
| - | _walkMagnitude = value / 32768; // Map the range to -1 to 1 | + | _walkMagnitude = (float)value / -float(_Joystick-> |
| break; | break; | ||
| case 3: | case 3: | ||
| - | _turnMagnitude = value / 32768; // Map the range to -1 to 1 | + | _turnMagnitude = (float)value / -float(_Joystick-> |
| - | break; | + | break; |
| } | } | ||
| return true; | return true; | ||
| Line 201: | Line 203: | ||
| } | } | ||
| // Create the translation vector. | // Create the translation vector. | ||
| - | if (0 != _walkMagnitude) { | + | SinbadTranslate = _node-> |
| - | SinbadTranslate = _node-> | + | walked = true; |
| - | walked = true; | + | |
| - | } | + | |
| // Increment the roation angle. | // Increment the roation angle. | ||
| - | if (0 != _turnMagnitude) { | + | _orientation += evt.timeSinceLastFrame * _turnMagnitude*2; |
| - | _orientation += evt.timeSinceLastFrame * _turnMagnitude*2; | + | |
| - | } | + | |
| // Now finally apply the rotation and translation. | // Now finally apply the rotation and translation. | ||
| _node-> | _node-> | ||
| Line 214: | Line 214: | ||
| </ | </ | ||
| - **As of now the camera follows Sinbad in a strange manner.** By adding buffered keyboard input, create a method of toggling the camera from following Sinbad behind his back, and a free roaming camera that you cam move with the mouse and " | - **As of now the camera follows Sinbad in a strange manner.** By adding buffered keyboard input, create a method of toggling the camera from following Sinbad behind his back, and a free roaming camera that you cam move with the mouse and " | ||
| - | // This will make the camera a child of the Sinbad Scene node, and thus all translation | + | // This will make the camera a child of the Sinbad Scene node, and thus all transformation |
| _node-> | _node-> | ||
| </ | </ | ||
| Line 241: | Line 241: | ||
| //... | //... | ||
| } | } | ||
| - | </ | + | </ |
| </ | </ | ||
/var/www/cadia.ru.is/wiki/data/attic/public/t-gede-14-1/lab5.1392564334.txt.gz · Last modified: 2024/04/29 13:32 (external edit)