Questions & Answers by Yu-Chung Chen aka Julian

Player mode: 'minimap' questions

Answer: It is actually very simple to implement this '2D' overlay map.

First I prepare 3 background transparent images to represent 'the field', the positions of 'the player' and 'the ball':

"minimap"
"ball_pos"
"camera_pos"

They will all be modeled as 'overlays' in Electro program. And I also measure the all field's dimension(where the most left, right, front, and back coordinates). In Electro's "do_timer()" event loop, I will keep track of the camera(player)'s and ball's position, and scale the coordinates to the scale of the "minimap" image. I use the center of the image, which is also the center of the field as the origin. Then in the same event loop I will just keep update/reposition the "ball_pos" and "camera_pos" overlays using scaled values (relative to the upper left corner of the viewing plane). Code looks like:


-- In the do_timer() event loop
-- Update camera and ball position info in minimap
local cx, cy, cz = E.get_entity_position(camera)
local bx, by, bz = E.get_entity_position(ball)

E.set_entity_position(overlay.camera_pos, viewport.L + get_scaled_u(cx), viewport.T - get_scaled_v(cz), 0)

E.set_entity_position(overlay.ball_pos,   viewport.L + get_scaled_u(bx), viewport.T - get_scaled_v(bz), 0)
        
      

To make overlays, we use Electro's "E.create_sprite()" function with "brushes". The position of the overlays will be based on the viewport four corner coordinates. We first create an "orthogonal camera" attaching to the scene pivot. Then using "E.get_display_union()" we will get the display viewport's one corner with width and height. Follow the description of "E.get_display_union", then we can position the overlays using the "orthogonal camera" coordinates.

It is actually better idea to implement this in a 3D way, since the overlays are not stereo. If the screen area that it covers is too big, that might interfere with users' viewing experience. So if you want to implement the "minimap" thing in VR application, try to make it small, simple but also comprehensive.

Player mode: bat and ball-hitting question

Answer:

Basically we did use the raw tracking values for the bat. We spent some time to get objects' scale in the scene right, since at the very first beginning we think this could be one main issue as you mentioned. But after testing using real scale size, we found that "virtual bat" is difficult to hit the actual size "virtual ball" (maybe it's just too realistic like real cricket? ;)). So to make the batting practice easier, we scale up both the "virtual bat" and "virtual ball" a little bit. Also the speed of incoming ball is also reduced compared to the real cricket bowling.

One thing worth mention is that in the newer version of Electro, it supports showing the "geom" outlines for better debugging. That really helps a lot, since quite a lot of failuar of trying getting "do_contact" working attemps are more or less related to the mismatch between object geometry and the "geom" object. But you just cannot see the "geom" in previous versions of Electro!


Last modified: Thu Dec 1 23:50:02 CST 2005