# Separation plane calculation

#### ras78

Hi, this is the asm code for the first light of my calvert:

Code:
``````SEPARATION_PLANE PrimaFila, 21062, 0, -25101, 14524612
BGL_LIGHT LIGHT_NAV, 0.008, 3.488, -886.512, 20, 0.60, 0.40, 0FFD4CE86h, 0.000000, 0.000000, 1.000000 ; source poly num = 1
PrimaFila label word``````

The runway heading is 320, so if I had right the vector components result are:

X: sin(320) x 32768 = -21062 (21062 used)
Y: cos(320) x 32768 = 25101 (-25101 used)
Distance: the distance from the gmax refpoint 0,0,0 are 443.256, so 443.256x32768 results in 14524612.

The problem is that my lights does not goes off when I pass over it and it is still visible from the opposite view. Are my calculation right?

#### Attachments

• test.jpg
116.7 KB · Views: 400

#### arno

Staff member
FSDevConf team
Resource contributor
Hi,

Why did you flip the plus and minus sign on the X and Y?

I think you need to make the distance negative in that case to get the correct side of the runway.

#### ras78

Thank you for the answer Arno. In fact I flipped the value because I followed the Wiki tutorial which says to take the X as negative value. By the way I'm going to test my code with the fixes.
As you may noticed from the attachment, my runway in GMAX is aligned with Y axis as I put the 320 rotation while exporting the models. In this case is correct to calculate the SIN and COS with 320? or should I use 0 as rotation?

#### pfabian

You definitely need to use true heading in your calculations, irrespective of what you use in GMAX.

I think that the tutorial might have you flip your coordinates due to the different angle they took or they might have had the reference point on the other side of the lamps. The best way I can recommend is to try the direction vector by using a small displacement (like 32768) and seeing that the lights go out on the correct side of the reference point, then experiment with the vector size to get the right distance.

#### ras78

I will try to put one single light in GMAX at point 0,0,0 and see what will happens. So the final rotation that I put when I export my models (320°) should not affect the calculation, right? I have to calculate the SIN and COS with the true heading of my runway, 32/14 without taking care about the rotation put in export process.

#### pfabian

Yes, the heading you put the model on in gmax or in placement tools should not matter. Putting a test light at 0,0,0 coordinates is a good way to test the vector direction.

#### ras78

Hi to all,
I've been able to solve my problem. First of all I tested the SEPARATION_PLANE with a light placed in 0,0,0 then I've extended the vector with the correct light position (in front of the runway). Basically my main problem was the calculation of X and Y component: I've used 32 as angle instead of 320 and... voilà! all works fine!