User:Scarbo/Advanced Manual Object Placement Tutorial

From SRB2 Wiki
Jump to navigation Jump to search

This is a tutorial for advanced techniques in NiGHTS manual object placement. This is for people who don't use NiGHTS OBJECTPLACE or when placing them on non-NiGHTS maps.

This is the most difficult tutorial on the Wiki. It assumes that you understand trigonometry very well.

Hoop Placement

Hoops that Form Odd Angles

We're going to make two hoops that form a 55° angle. We'll have it so that Super Sonic goes through the first hoop forward with the hoop having a 2° backward tilt. The second hoop will be forward with a 53° upward tilt. Now first we have to find the proper Angles.

Since Super Sonic is going East for both of these, the yaw value is -16384. But the pitch values aren't quite so obvious. Once you add 256 to the pitch value, it is still horizontal, but it slightly tilts the yaw. Therefore, a "circle" would be 256 "Hoop units". But we must find a formula to calculate degrees pitch values to Angle values. Therefore, you would multiply degrees by 256/360 to calculate the pitch value. -2 × 256/360 = -1.422. We'll round that. So the pitch is -1. Although technically, pitches are positive, adding -1 to -16384 (the yaw value) will still produce the correct result, as such a yaw turn is basically insignificant. So the Angle of our first hoop is -16385.

Now we must find the pitch value of the second hoop. Using our formula, 53 × 256/360 = 37.688. We'll round that to 38. Adding that to -16384 produces a total Angle of -16346.

Now it is time to find the proper relative height and distance values. Now think of a circle. How would you find the horizontal and vertical distances from the radius? You would use the sine function for vertical distance and cosine function for horizontal distance. The same applies here:

It's time to think about the hoops as lines on a circle. Now, the Doom engine understands 270° as South. In this circle we're thinking about, 270° would correspondingly be "down". So the first hoop is 2° backwards, that means the angle on this imaginary circle would be 268°. Now, we need to find a horizontal distance. If a hoop had a radius of 1 fracunit, the horizontal distance would simply be cos 268°. However, as a hoop's radius is 96 fracunits, the horizontal distance would be 96 cos 268°, which is about -3.35. We have to round it; so we'll give "X1" a value of -3. Now we need to find the vertical distance. That would be 96 sin 268°, which is about -95.94. We'll give "Y1" the rounded value, -96.

Let's do so for the second hoop. The horizontal distance is 96 cos 323°, which is about 76.66. We'll set "X2" to the rounded value, 77. The vertical distance is 96 sin 323°, which is about -57.77. We'll round this value to -58 and set "Y2" to that.

Now, to find the true relative vertical distance, we take Y2 – Y1. This value is 38. The horizontal relative distance is X2 – X1, which is 80. That means the second hoop needs to be 80 fracunits east of the first hoop, and it also needs to be 38 fracunits higher than the first hoop.

MORE TO COME!