Graphics Reference
In-Depth Information
V v ) are computed at label C. At label D, these vectors are used to create a rotation
matrix. This rotation matrix is assigned at label E to orient the orthonormal basis
according to the transforms. Finally, at label F, the velocity of the traveling sphere
is set to the negative- z direction, which is the forward direction of the shusui plane
node.
16.6
Collision in 3D
At this point, we understand how to compute the position and orientation (or-
thonormal basis) of any scene node in a general scene hierarchy. So far, we have
worked with examples of using this information to aim objects and to move ob-
jects along predetermined paths. In this section, we examine computing intersec-
tion of scene nodes in 3D.
Tutorial 16.8.
Project Name:
D3D _ CollisionIn3D
Library Support:
UWB _ MFC _ Lib1
UWB _ D3D _ Lib17
Tutorial 16.8. Collision Computation in 3D
Goal. Demonstrate that we can collide scene nodes in 3D space in similar
fashion as in 2D.
Approach. Implement the collision between a simple scene node and the
leaf node of a general hierarchy.
Figure 16.18 is a screenshot of running Tutorial 16.8. At the center is the two-level
trophy scene node hierarchy from the previous tutorial where the plane shusui is
a leaf node. Click on the“Tiger Shoots” checkbox to see the tiger aim toward
the hierarchy and continuously release spheres toward the shusui leaf node. Now
select the trophy scene node hierarchy and transform the entire hierarchy, e.g.,
translate the scene node along the x -axis. Notice that when missed, the sphere
will continue to travel for a few seconds before another sphere is released from
the tiger. Now, select and change the transformation of the shusui leaf node.
Notice that the tiger is aiming and releasing the sphere toward the shusui leaf
node. The implementation of this tutorial combines many of the concepts we
have learned from the previous tutorials. For example, Listing 16.22 showed us
how to compute the position of the shusui leaf node, Listing 16.16 showed us how
to aim the tiger toward the computed shusui position, and Listing 16.13 showed
us how to move the sphere along the defined path.
In this tutorial, we are interested in the details of intersecting the sphere with
the shusui node. As discussed in Section 7.5, computing accurate collisions be-
tween graphical primitives or objects involves tedious mathematics. In computer
Figure 16.18.
Tutorial
16.8.
 
Search WWH ::




Custom Search