Search and Rescue Manual
Index-> Create Your Own-> Creating Objects

Creating Objects

This document describes how to create SAR Objects (Search and Rescue Objects) for use in Search and Rescue's scenery.

[ Top | Create Your Own ]

Requirements

Vertex 3D

The SAR 3D Object is basically a Vertex 3D Object (V3D Object), this means that you will need Vertex 3D (a free OpenGL modeller) to create and edit SAR 3D Objects.

Search and Rescue

You should also have Search and Rescue and its data files installed.

ScnEdit

To add SAR 3D Objects to the SAR Scenery files you can either use a text editor or ScnEdit.

LightWave 3D (optional)

Alternately you can use LightWave 3D to create LWO models and then import them to a V3D Object using Vertex 3D. To learn how to do this you should read the LWO Importing HOWTO.

[ Top | Create Your Own ]

SAR 3D Object Format

This section defines the official SAR 3D Object format as of version 0.8.1. The SAR 3D Object format is essentially the V3D Object format (the object format created and edited by Vertex 3D).

Here we will refer to it as the "SAR 3D Object format" or just the "object format" (not the V3D Object format even though they are essentially the same thing).

Type

Each SAR Object has a type, that specifies what type of object it is (static, ground, aircraft, etc). The SAR 3D Object format can be "extended" (i.e. have more parameters) depending on its type. The following are a list of SAR Object types and their respective type code:

  • Static 1
  • Automobile 2
  • Watercraft 3
  • Aircraft 4
  • Ground 6
  • Runway 7
  • Helipad 8
  • Actor/Human 9
  • Smoke 10
  • Fire 11
  • Explosion 12
  • Chemical Spray 13
  • Fuel Tank 14
  • Premodeled 20

This document only describes the object format for objects of type static (type code 1). For other object types (such as aircraft), please refer to the appropriate documentation. Note that such documentation for other types of SAR Objects specify parameters that are on top of the parameters listed here.

Layout

Since the SAR Object is really a V3D Object, it contains V3D visual models and "other data" models. For SAR Object of type static the layout should be as follows:

  • Header
  • "Other data" (optional/misc header)
  • "Other data" (text section with parameters)
  • Visual model standard
  • Visual model standard_far (optional)
  • Visual model standard_night (optional)
  • Visual model shadow (optional)

The first "other data" model in the SAR Object file is sometimes kept for the internal use by Vertex 3D and, for this reason, Search and Rescue ignores it.

The second "other data" model is a text section that contains the SAR Object parameters.

Next is the first visual model, it should be named standard. Every SAR Object must have a visual model named standard.

The subsequent visual models standard_far, standard_night, and shadow are optional.

The standard_far visual model is displayed when the camera is farther than the distance specified by the parameter range_far (but still with in the distance specified by range). For this reason you should make the standard_far visual model simpler in detail.

The standard_night visual model is displayed during night time and without lighting (so therefore it is not shaded). This is useful for displaying lit windows at night. This visual model can also be displayed at dawn by specifying show_night_model_at_dawn and displayed at dusk by specifying show_night_model_at_dusk.

The shadow visual model is displayed as the object's shadow. It should have no color or texture primitives in it.

With other types of SAR Objects, additional "other data" models may need to be placed between (just before) each visual model. Please keep this in mind when you work with other types of SAR Objects later on.

Parameters

As mentioned above, the parameters listed here belong in the second "other data" model in the SAR Object file. All parameters listed here apply to all types of SAR Objects.

SAR Scenery files have a separate set of parameters which differ from the parameters listed here. There are some parameters for SAR Scenery files that are identical to the parameters for SAR Object files, but keep in mind that not all parameters listed here can be used in SAR Scenery files (and vice versa).

Legend:

  • Distances are in meters
  • Angles are in degrees
  • Heights are in feet (unless noted otherwise)
  • Colors are in coefficients [0.0 to 1.0]
  • Strings can be escaped with the \ character (if and only if it is the sole argument)
  • Flags are denoted with a ? in the argument name and can be a value of 0 (unset) or 1 (set)
  • Intervals are in milliseconds and are denoted with a _int in the argument name
Parameter Argument(s) Remarks
contact_cylendrical r h_min h_max Cylendrical contact bounds
contact_rectangular x_min x_max y_min y_max z_min z_max Rectangular contact bounds
contact_spherical r Spherical contact bounds
crash_flags crash_other? causes_crash? support_surface? crash_code crash_other? specifies that it can crash into other objects that have causes_crash? set to 1.
support_surface? specifies that other objects can "land" or "walk" on it.
crash_code specifies what kind of crash would occure if something crashed into it (used only if causes_crash? is 1); 0 = obstruction, 1 = ground, 2 = mountain, 3 = building, 4 = aircraft.
description s Description of object
light_new x y z r g b a radius on? type on_int off_int Adds a new light to the object. type 0 is standard light, 1 is strobe 2 is spotlight (only 1 per object). on_int and off_int only apply to strobes (otherwise leave both as 0)
name s Name of object
range d Visible range (spherical)
range_far d Far model visible range (spherical)
shade_model_smooth *none* Specifies that the visual models should be displayed using smooth shading (GL_SMOOTH).
show_night_model_at_dawn *none* Specifies that the standard_night visual model should be displayed at dawn.
show_night_model_at_dusk *none* Specifies that the standard_night visual model should be displayed at dusk.
type type Depreciated, the object's type is now set by the SAR Scenery file.
version major minor release Specifies 3 numbers that represent the minmum version of Search and Rescue needed to display this object.

Example

This is an example of a SAR Object file as seen when viewed with a text editor (note that the visual model data has been omitted and replaced with a ... for brevity):

hangar01.3d (12 kb)


begin_header
author unspecified
texture_base_directory /usr/share/games/SearchAndRescue
texture_load hanger01 textures/hanger01.tex 0.600000
texture_load hanger02 textures/hanger02.tex 0.800000
end_header

# This is a comment, all lines starting with a # are comments

# Display range (in meters)
range 5000

# Range to display standard_far model (in meters)
range_far 2000

# Use smooth shading
shade_model_smooth


begin_model standard
 ...
end_model standard

begin_model standard_far
 ...
end_model standard_far

begin_model shadow
 ...
end_model shadow

SAR Object File Location

You should place your SAR Object files in one of the following directories from the Search and Rescue data directory.

  • aircrafts/ - For aircrafts
  • automobiles/ - For cars, trucks, and other land vehicles
  • objects/ - For most objects in general
  • vessels/ - For ships and vehicles that go on water

You can create subdirectories within the directories listed above to help you organize things.

[
Top | Create Your Own ]

Adding To The Scenery

This section describes how to add a SAR Object to a SAR Scenery file.

There are two methods to achieve this:

  1. Using a text editor
  2. Using ScnEdit

Using a Text Editor

The first step is to edit the SAR Scenery file, the scenery files are located in:

  • scenery/

All SAR Scenery files have a .scn extension and are of plain text format.

Run your prefered text editor and open the SAR Scenery file that you want to add your SAR Object in to.

To add a SAR Object of type static into the SAR Scenery file use the code:

Sample Portion of a Scenery File


# Create a new object of type static (type code 1), this puts the new
# object in to the current context so subsequent scenery parameters will
# operate on this new object
create_object 1

# Load the object file for the new object that we just created
model_file objects/hangar01.3d

# Range (in meters), this overrides the range specified in the object
# file (optional)
range 2000

# Set position (in meters)
translation -56.0 -250.0 0.0

# Set direction (in degrees)
rotate 310 0 0

# Set name of object (optional, no spaces)
object_name my_hangar_01

# Set descrption of object that is to be displayed on the mission
# briefing map (optional)
object_map_description 

# Disable depth testing when drawing this object, useful for "flat"
# objects that are intended to be landmarks or flat areas of land
# (optional)
#no_depth_test

The create_object parameter specifies that a new object be created and of the specified type.

When using the model_file parameter, note that the Search and Rescue data directory will be automatically prepended to it. So you only need to specify the relative path to your SAR Object file from the Search and Rescue data directory.

You can edit a SAR Scenery file while Search and Rescue is running! Once you save the SAR Scenery file you need to exit simulation and then restart free flight or the mission (whichever you were playing).

If you just modified a SAR Scenery and you want to see how it looks, run Search and Rescue from a text prompt (XTerm, DOS Prompt, etc) so you can see the error messages (if any) regarding your new modifications.

Using ScnEdit

This method assumes that you have some experience in using ScnEdit.

The first step is to open the SAR Scenery file, as you would with a text editor.

Position the cursor at the coordinates where you want the new object to be placed, then select from the object list where you want the object to be inserted in the order of objects.

Now go to Edit->New Object, a new object will be created. Specify the appropriate values for the new object in the object values pane.

Specify the new SAR Object file location in the Model File prompt, note that the Search and Rescue data directory will be automatically prepended to it. So you only need to specify the relative path to your SAR Object file from the Search and Rescue data directory.

Object Ordering

The order in which the SAR Object is specified in the SAR Scenery file is important. The SAR Objects are drawing in serial order, so if you use the no_depth_test parameter then you need to arrange the objects in proper order. In general the objects should appear in a SAR Scenery as follows:

  1. Ground objects acting as "flat" landmarks
  2. Ground objects acting as mountains (heightfields)
  3. Runways, roads, railroads, rivers, etc
  4. Helipads (not on buildings)
  5. Static objects, buildings, obstructions
  6. Helipads (on top of buildings)
[
Top | Create Your Own ]

Search and Rescue

http://wolfpack.twu.net/SearchAndRescue