Cameras



Start out making a single room, with a 3x1 unit window and window sill.


Insert two sprites, a viewscreen sprite (tile #502) and a camera sprite (tile #621.) Put the viewscreen sprite flat against the window's wall. Put the camera in one corner, and raise it to the ceiling. Change the viewscreen's hitag to 1, and set the camera's lotag to 1. The viewscreen will show all cameras whose lotags match its hitag. Set the camera angle to point towards the middle of the room. Set the camera's hitag to 256. This will be our camera's turning radius (see notes at bottom for an explanation.)


That's all you need to make the camera work, but we want to make a fancier security screen. We made a separate window sill earlier, and now it's going to come into play. Change the height of the sector containing your viewscreen so you can see the window sill "step." Resize the viewscreen sprite to match the size of the opening. While pointing at the wall of this step in 3d mode, hit 'M' to make it a maskwall. A tile will fill the space between the floor and ceiling. Point at this "wall" and change its tile to a forcefield (tile #663). While still pointing at the wall, hit 'B' and then 'H' to make it blocking and masking, respectively. Switch back to 2d mode, turn off grid-lock, and move the window sill corners and window corners right up next to the wall. Switch back to 3d mode and adjust the outer window sill height to match that of the inner window and make that wall blocking but not masking. This way, Duke will not get hurt by the forcefield and you still get that neat sound when shooting at it plus, you've got a nice-looking screen that is recessed into the wall.

Now you probably want to change the angle the camera points to... up or down. The angle of the camera is determined by the shade value of the sprite itself. The shade value of any sprite is between -128 and +127. The positive shade values will force the camera to point upwards, as high as 127 degrees. The negative shade values will force the camera to point downwards, as low as -128 degrees. To set the shade of our camera, switch to 3d mode, point at the sprite, hold down the ['] key, and hit [S]. If this key combination causes your machine to goof up, use the [+] and [-] keys to manually increment/decrement the shade value.

Please note that the pan angle of travel of the camera is, as stated above, set by the camera's hitag value. These values span from 0, for a fixed camera to 2048 for a complete 360 degree turn. It is also important to remember that this value represents the angle panned on either side of the pointing angle of the sprite. So if you assign it a value of 512, for example (1/4 of 2048), it will describe an arc of 90 degrees on the left and right side of the camera's axis for a total arc of 180 degrees. Although the use of exact divisions of 2048 is not absolutely necessary, it guarantees trouble-free operation. Small uneven values like 90 tend to make the cameras operate erratically. Experiment and see what works best for you.


Download this page locally




Duke Nukem 3D is copyright ©1996 , All Rights reserved.

THIS PAGE IS NOT MADE BY OR SUPPORTED BY 3D REALMS

Copyright ©1996 Tyler Matthews and Jean-Francois Groleau, All Rights reserved.
Go back to my Duke FAQ BUILD page
Go back to my Duke FAQ BUILD page Text-Only