Combining the formulas
We now have two formulas: one for zero and above, and the other for below zero. To combine these, we will make use of an if-else statement block. Also, a quick look at the formulas that we have been experimenting with shows that the int(_xmouse / 100 * 36) part gets used quite a bit (and we'll need to use it again in the if statement's condition test). Let's put that into a variable so that we don't have to calculate it over and over again. Here's the code for our driver Movie Clip:
onClipEvent (enterFrame) {
framePos = int(_xmouse / 100 * 36);
if (framePos <%lt%> 0) {
_parent.gotoAndStop(36 + ((framePos + 1) % 36));
} else {
_parent.gotoAndStop(1 + (framePos % 36));
}
}
This is all very well if your QTVR movie is of an object rotating anticlockwise (as seen from above), but if your object rotates clockwise then you have a problem. What you end up with is an object that seems to rotate from right to left as you move your mouse from left to right. (If you have a look at the series of images that we had for the diving helmet, you can see that our QTVR movie rotated clockwise.)
The effect we are after is similar to the experience of running your hand across a prayer wheel: you expect the surface that you touch to move in the same direction.
The simple solution is to subtract our 1 to 36 value from 37. This will give us a range that runs in the other direction (36 to 1). This is what we needed for the "Western Australia: Land and People" exhibition, but your Object VR may well run in the other direction. Use what you need. Here's our code so far:
onClipEvent (enterFrame) {
framePos = int(_xmouse / 100 * 36);
if (framePos <%lt%> 0) {
_parent.gotoAndStop(37 - (36 + ((framePos + 1) % 36)));
} else {
_parent.gotoAndStop(37 - (1 + (framePos % 36)));
}
} | » Level Advanced |
|
Added: 2003-12-16 Rating: 8 Votes: 76 |
| » Author |
| Tim is a co-director of the Glasson Murray Group, providing quality graphic design, illustration, 3D visualisation, interactive environments, virtual reality, multimedia and website services. |
| » Download |
| Download the files used in this tutorial. |
| Download (1028 kb) |
| » Forums |
| More help? Search our boards for quick answers! |
-
You must have javascript enabled in order to post comments.


Comments
There are no comments yet. Be the first to comment!