Game Design Lab 3

Getting Squished or Elevated by a Sphere

This lab will introduce a little bit of actual gameplay to our examples! Begin with the lighting demo from today (September 11). Add a sphere that rolls around on the ground. Keep the sphere on one axis (x or z) to make calculations much easier. The sphere should rotate as it moves, so that the part of the sphere in contact with the ground doesn't appear to slide. For this, you'll need to do some calculation regarding the circonference of the sphere, and make sure the axis of rotation is both horizontal and perpendicular to the direction of travel. This is much easier with the sphere traveling in either the x or z direction, but not both. Use of a wireframe sphere will make it easier to tell what direction the sphere is rotating. The sphere should roll back and forth, or in some way not leave the ground.
Next, add logic so that when the sphere is in contact with the camera position, the camera is moved either up or down. Take your pick on if the sphere should elevate the camera or run over it. Change the y position smoothly, but you don't have to be true to the contour of the sphere. Approximation like this is ok: camera_height = abs(distance between camera and sphere).