Vector3Bvr throwVector = (Vector3Bvr)eventData;
Vector3Bvr throwDirection = derivative((Vector3Bvr)curBvr);
Vector3Bvr pathDirection = vector3(toBvr(-1), toBvr(0), toBvr(0));
Vector3Bvr[] points = {
throwVector,
add(throwVector, throwDirection),
add(add(throwVector, pathVector).div(toBvr(2)),
sub(throwDirection, pathDirection)),
sub(pathVector, pathDirection.div(toBvr(3))),
pathVector
};
NumberBvr[] knots = { toBvr(0), toBvr(0), toBvr(0),
toBvr(1), toBvr(2), toBvr(2), toBvr(2) };
NumberBvr[] weights = { toBvr(1), toBvr(1),
toBvr(1), toBvr(1), toBvr(1) };
Vector3Bvr spline = bSpline(3, knots, points, weights,localTime);
Let the seagull fly the path in two seconds, and then return to its
original path. |
Vector3Bvr throwPath = (Vector3Bvr)
until( spline, timer(toBvr(2)),originalPath);
return throwPath;
}
}
Create a behavior that starts out as _original path, and then changes to
the behavior constructed in the grabbedBird class when _grabEvent is
triggered. |
Vector3Bvr finalPath = (Vector3Bvr)untilNotify(
_originalPath, _grabEvent, _grabbedNotify);
Create an event that gets triggered when the left mouse button is
released. Also create an event that snapshots the value of finalPath
when throwEvent is triggered. |
DXMEvent throwEvent = leftButtonUp;
DXMEvent throwSnapEvent = throwEvent.snapshotEvent(finalPath);
Create a behavior that starts out as finalPath, and then changes to
the behavior constructed in the thrownBird class when throwSnapEvent is
triggered. This is the composite seagull path that allows the user to
grab it, drag it, and release it. |
_actualPath = (Vector3Bvr)untilNotify(
finalPath, throwSnapEvent, _thrownNotify);
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.