Monday, April 04, 2005
With the addition of the addition of the llGetObjectMass command (as of v1.6), SL Sumo is much closer to becoming a reality. I had already made a prototype sumo suit a week or two ago. The collision routine turned out to be surprisingly complicated. On collision between two players, the suit must:
- Verify that the collision is with a valid opponent. Eventually, the suits will be designed such that they will only work inside the arena. I don't want the them to work all the time. Otherwise, they'd become yet another griefing tool.
- Calculate direction vector to the target. The impact force vector will be applied along the direction vector, so that the opponent is launched on a radial line directly away from the wearer.
- Check the wearer's velocity at time of impact. The magnitude of the force vector will be scaled based on the velocity (faster impact means more force applied).
- Check the opponent's mass. The magnitude of the force vector is scaled by the opponent's mass, with larger opponents receiving larger impulses. I realized early on that this must be done in order to level the playing field. Otherwise, smaller avs would get launched into orbit by forces that would only send a larger av back a couple of steps. This step was made considerably easier with v1.6 and the llGetObjectMass command. (While I realize that superior mass is an advantage in RL sumo wrestling, I didn't want people gaming the system here. RL sumo wrestlers train for years to increase their body mass. SL sumos can just adjust a few sliders.)
- Calculate the X and Y components of the force vector.
- Apply the force vector to the opponent with llPushObject.
- Sleep for a second or so, to prevent machine-gun bursts of impulses.
On a completely different topic, I realized that I was taking my stereo pairs slightly wrong. Most stereo sets are taken with the camera views set parallel, instead of pointing inward at the subject. My previous method (center the camera on an object, take a screenshot, rotate the camera slightly, take another screenshot) yielded slightly distorted results. For a good example, take a look at this picture. The foreground objects came out reasonably well. But the background (the trees and the park entry arch) objects refuse to resolve properly. (Note also that the trees are blowing in the wind, creating further problems. Picking backdrops can be tricky.) For most objects, the method described works well enough. But with more complex images, with several foreground, mid-ground, and background objects (like the park bench picture linked above), the parallax errors stack up.
This is unfortunate, as it means that many of my accidental screenshot stereo pairs won't work as I had hoped. However, it is easy enough to take new ones in-game. Line up your first shot (left eye view) and take a screen capture. Then use the camera tool (see the View pulldown) to pan the camera to the right slightly. Use the arrows labeled "Move camera up, down, left, and right," on the right side of the camera control window. This will move the camera directly to the right without changing the angle. This is a reasonable in-game approximation of the so-called "Cha-Cha Method" of single-camera stereo photography.
While this works fine for informal pictures, especially at a distance (such as pictures of landscapes), there is room for improvement when photographing nearer objects. The distance between RL human eyes is about 2.5" (0.0635m). This works fine for subjects that are about 7 feet (2.1m) away. Many stereo photographers use the "1/30 Rule." That is, the camera should be shifted 1/30th of the distance from camera to the nearest object. So if the object is 30m away, the camera should be shifted about 1m to produce an effective 3-D effect. If it is 1.5m away, 0.05m could be used. From what I've seen, this is not a hard-and-fast rule, though.
However, the camera controls are not precise enough to do this very well for nearer objects. I expect that I will eventually make a camera pan chair for the purpose. At its simplest form, this would just be a simple chair equipped with a fixed camera angle. The user would sit down, and his camera would be fixed and pointed just in front of him. Then, the object edit tools could be used to adjust the position and offset. Ideally, a simple, user-controlled platform could be made to move around, adjust angles, and manage the camera offsets for a given user-defined subject distance. Yet another project, I guess... Someday.