Game Development Reference
In-Depth Information
All the Same: Springs, Slings, and Bows
First, let me clarify that the springboard object here will function no different than a sling-
shot or a bow. There's a spring trying to pull an object in a specific direction, though with
varying degrees of force. I wager a bow will fire an arrow at a higher velocity than a
slingshot fires a bird, angry or not.
There must also be an opposing force that pulls the spring backward and keeps it locked
in place. Usually, the part of the opposing force is played by the archer's grip keeping the
string pulled back while aiming. Only when the lock (grip) is released will the spring ac-
celerate the object (arrow). The object will eventually leave the influence of the spring.
Usually, this happens when the spring has passed its resting position and is slowing down.
In computer physics, the real problem is related to attaching the movable object while the
spring is held back and while it is accelerating. Usually, you'll need some helper colli-
sions—for instance, a bowl-shaped container that holds the object in place while the
spring accelerates. Or in the case of bow and arrow, there could be two tiny, circular colli-
sion pins just above and below the arrow's head on the bow frame just to hold the arrow
in place, and perhaps to ensure it is firing in the correct general direction.
You often have to implement such “cheats” to model real-world physics with computer
physics—a common misunderstanding is that both types of physics work generally the
same, but that's not true. Computer physics work with a lot of simplifications and gross
exaggerations in order to process a decent quantity of physics objects in real time.
In the case of the springboard, you'll be most concerned with stopping the spring, to avoid
the spring from shooting out and away from its base. Therefore, it has to have a stopper
collision that stops the spring abruptly before it can leave the base's shaft.
That said, let's examine the springboard's constituent components, which are shown in
Figure 9-16 .
Search WWH ::




Custom Search