2. Placing objects in the TE, object descriptions
2.1 Internal objects
2.2 object description
2.3 0x80 command
2.4 Viewing objects in GP2 (pitbuildings, anchors, lighting)
3. Basic construction of objects - vertices, lines, planes,
textures, scales
3.1 vertices - scales, refering points, heights
3.2 lines
3.3 planes, textures
4. Editing the Objects
4.1 Choosing the base
4.2 changing scales
4.3 changing scale references
4.4 texture changing
5. A few examples
6. miscellanious: object 5, bunchtrees
7. FAQ
This writing doesn’t have the intention of being complete or anything,
so when there’s something you don’t understand or want to know more about,
or just want to express your gratitude for this writing, please drop me
a note, at m.p.j.keizer@sepa.tudelft.nl .
lateral distance (DFC)
This figure gives the distance that the anchor of the object is placed
from the centerline of the track. I don’t know the scale-values, but it
seems like it’s the same as the ribbons. About 256 is the edge of the track.
These values also seem to change when the trackwidth is changed, just like
the ribbon- and fence distances. You can use both positive and negative
values, where positive values are to the right of the track, and negatives
are to the left.
Height
This figure determines the height of the anchor of the object, in relation
to the tracksector it is placed in. A value of zero means it’s the same
height as the tracksector. You can use both positive and negative values.
Angle X
With this value you can rotate an object round the Z-axis. The values
are from 0 to 65535, so for a 180-degree turn (for instance when you want
to show the backside of an advertisement), you use 32768.
Angle Y
With this value, you rotate an object around it’s X-axis. Well, perhaps
not it’s X-axis, but it’s a little vague in which order the rotations take
place. Anyway, you can use this to rotate a grandstand in case the track
is sloped, so that the grandstand is sloped in the same direction. .
the viewlevel
With this value, you determine on which detail levels the object is
visible. I think that it’s a "digital checkbox" format, but as the values
aren’t worked out, I’ll just give a list of the "known ones". These can
also be found in the trackeditor.
4- always on
100 - detail level high
64- detail level medium
2- detail level low
148 - show before fences
These are, AFAIK, also the only values that are used on the original
tracks.
The "show before fences" perhaps needs a little explanation. Usually, the drawing order for GP2 is (back to forth) ribbons, objects, fences. But sometimes you want an object to be seen before the fences. A good example of this are the (300, 200, 100) signs that tell you when there’s a corner coming up. When you set the detaillevel to 148, you make sure the object is visible before the fences. So ofcourse you should also plcae the object before the fences then, as it will otherwise look like it’s leaking through.
the internal object ID
Ofcourse the object description needs to know to which object it should
apply all this stuff.
ID 2, used incase the Internal Object needs it.
Some special internal objects require a second ID. An example for this
is "internal object 5" (which is more of an external object, as it’s hardcoded
in GP2.exe, and not in the trackfile). The original trees are all made
like this: an object description points to "object 5", and with the ID2
is determined which textureID has to be used bu that object description.
If you add 256 to ID2, you get the textureID that’s being used by that
object description. That also means that you have to use texture ID’s in
the range from 257 to 511 if you want to use them in an "object5" description.
Basically, there are a few different values defined for the object that you can choose from to use as an X or Y coordinate. These values are called "scales". There are typically about 1 to 5 scales per object. With the X and Y values, you point to a scale. You can determine which scale is used by entering a value in the X or Y-pointsdata. It works like this, if you want:
positive reference | negative reference | |
scale 1 | 4 | 132 |
scale 2 | 8 | 136 |
scale 3 | 12 | 140 |
So for instance if you want point(0) to have X=scale1, and Y= minus
scale 2, you would enter:
X=4
Y=136
The advantage of programming the objects like this, is that you can easily stretch an object in one direction, by adjusting the "scale" value.
There’s also a way to "couple" points to one-another. You can tell GP2
to use the same points(X, Y) data for point(2), as is used for point(0).
You do this by entering in the X-field, a value of
32768 to copy p(0)’s X and Y value.
32769 to copy p(1)’s X and Y value.
32770 to copy p(2)’s X and Y value.
etc.
Sometimes, you want to "de-couple" points if you want to change the
appearance of the objects. You can do this best in two steps: first, change
the X and Y value of point(2) to the exact scales of point(0). Then, you
can make the changes to the object, without worrying that changing point(0)’s
position, changes point(2)’s position as well.
A polygon has a texture applied to it. You can find these in the "texture
data". Some textures have another entry except for the "texture ID", and
these are repeat values (called "horizontal/vertical resolution"). With
these, yoy can determine yourself how many textures you want to have side-by-side
or above one-another on that polygon. For instance, on a pitbuilding, you
want 16 pitstalls next to one-another, without having to create ne enormous
texture with those 16 in it. So you enter the texture ID of a pitstall,
and enter a repeat value. You have to multiply the numberof repeats with
256, and enter that value in the box. So for 16 pitstalls, the value would
become 256x16=4096.
In this case, we basically need only need two boxes on top of one-another. The marshall-boxes that are used on Spa-Francorchamps (ID1=21) are just that, so that looks like a fine base.
[spa_21], the base of the pittent-to-be
[spa_21_scales]
Now you see the basic form is OK.
This would also be a good time to inform you of the fact that 1024 object-units is exactly as long as one tracklengthunit, which is in turn 16 "real" feet, which is 4.87 meters. That makes one objectunit equal to 4.75 millimeters, or for those who haven't learned metric yet: 3/16th of an inch or (if you like) 1/337684th of a mile.
[spa_21_scales2]
The object looks like this after that:
[spa_21_scales3]
Note how neatly the connection is done.... math is beautiful, isn't
it?
This might also be a good time to give you a tip about rotating the object: when you press the "ctrl" key while rotating the object, it gets rotated only by the Z-axis, while when you rotate without pressing "ctrl", it rotates the object around the X and Y axis.
Anyway, just change the number in the texture data to the ID# of the
texture you desire there. You can check whether all the textures you have
enteredfor that object are actually contained in the track, by clicking
on the "fill objects" and "texture map objects" buttons. An unknown texture-ID
is represented by a red/white blocked pattern.
[spa_21_texs]
And now that the object is finished, you only need to place it in your track by changing one object description and placing this in the track with an 0x80 command. I
In the game, the pittents might look like this: