Difference between revisions of "Rotate with wind direction (ASM tweak)"

From FSDeveloper Wiki
Jump to: navigation, search
 
m (The famous rotate with wind bug)
 
(17 intermediate revisions by 2 users not shown)
Line 1: Line 1:
This article describes how you can tweak the ASM source code to let an object rotate with the wind. This can be useful to make a windsock or a flag respond to the wind like it should. Below you find two section that describe how to perform this tweak for the Fs2002 and the Fs2004 gamepack.
+
{{Infobox-Applicable-FSVersion
 +
| FSXI = false
 +
| FSXA = false
 +
| FSX = false
 +
| FS2004 = true
 +
| FS2002 = true
 +
| FS2000 = unknown
 +
| FS98 = unknown
 +
}}
 +
 
 +
This article describes how you can tweak the ASM source code to let an object rotate with the wind. This can be useful to make a windsock or a flag respond to the wind like it should.  
 +
 
 +
Below you find two section that describe how to perform this tweak for the Fs2002 and the Fs2004 gamepack.
  
 
Please note that the tweak as described here applies to your total GMax scene and the rotation is done around the 0,0 point.
 
Please note that the tweak as described here applies to your total GMax scene and the rotation is done around the 0,0 point.
  
= Fs2002 gamepack =
+
== Fs2002 gamepack ==
  
 
Find the line as indicated below where the BGL_CALL command is:
 
Find the line as indicated below where the BGL_CALL command is:
Line 19: Line 31:
 
Now the entire object will rotate with the direction of the wind around the 0,0 point in GMax.  
 
Now the entire object will rotate with the direction of the wind around the 0,0 point in GMax.  
  
= Fs2004 gamepack =
+
== Fs2004 gamepack ==
  
 
For the Fs2004 gamepack you need to find the BGL_CALL_32 command that calls your MasterScale label in the BGL section of your ASM file. This code looks something like this:
 
For the Fs2004 gamepack you need to find the BGL_CALL_32 command that calls your MasterScale label in the BGL section of your ASM file. This code looks something like this:
Line 43: Line 55:
 
= The famous rotate with wind bug =
 
= The famous rotate with wind bug =
  
It is a know problem of FS that the change in rotation will not always happen as soon as you change the wind direction in the weather menu. A fix for this is to place more then one object that rotate with the wind. When two of these objects are visible (on your screen) at the same time, it will work. If you only want to place one windsock for example you can best hide the others ones in buildings or so.
+
It is a known problem of FS that the change in rotation will not always happen as soon as you change the wind direction in the weather menu. A fix for this is to place more then one object that rotate with the wind. When two of these objects are visible (on your screen) at the same time, it will work. If you only want to place one windsock for example you can best hide the others ones in buildings or so.
  
[[category:Scenery design]]
+
[[category:Tweaking]]
 +
[[Category:Scenery_Design]]

Latest revision as of 19:19, 10 October 2009

This article describes how you can tweak the ASM source code to let an object rotate with the wind. This can be useful to make a windsock or a flag respond to the wind like it should.

Below you find two section that describe how to perform this tweak for the Fs2002 and the Fs2004 gamepack.

Please note that the tweak as described here applies to your total GMax scene and the rotation is done around the 0,0 point.

Fs2002 gamepack

Find the line as indicated below where the BGL_CALL command is:

SCALE_AGL OBJECT_0_RETURN, 10000, 126, 131072, 00043D426h, 038E4h, 0E38E38E3h, 08E39h, 0, 0
BGL_CALL OBJECT_0_BEGIN
OBJECT_0_RETURN label word

If you have added a rotation to your object during export it could also be that the BGL_CALL command is replaced by an INSTANCE_CALL command. But that does not matter for this tweak, you still need to replace that line with the one given below.

SCALE_AGL OBJECT_0_RETURN, 10000, 126, 131072, 00043D426h, 038E4h, 0E38E38E3h, 08E39h, 0, 0
POINT_VICALL OBJECT_0_BEGIN, 0, 0, 0, 0, 0, 0, 0, 0, global_winds_surface_direction
OBJECT_0_RETURN label word

Now the entire object will rotate with the direction of the wind around the 0,0 point in GMax.

Fs2004 gamepack

For the Fs2004 gamepack you need to find the BGL_CALL_32 command that calls your MasterScale label in the BGL section of your ASM file. This code looks something like this:

; NonAlpha
test_NonAlpha label BGLCODE
BGL_CALL_32 test_MasterScale_1
BGL_END
BGL_RETURN

Then replace the BGL_CALL_32 command with the SPRITE_VICALL command as shown below:

; NonAlpha
test_NonAlpha label BGLCODE
POINT_VICALL test_MasterScale_1, 0, 0, 0, 0, 0, 0, 0, 0, global_winds_surface_direction
BGL_END
BGL_RETURN

Please note that the labels can have slightly different names in your source file. These depend on the name of your project, in my case that was test. Also note that you need the Fs2004 version of BGLC (BGLC_9) to be able to compile the source without errors.

There is one last limitation of this tweak. When you place a tweak MDL object you always need to use heading zero, else the object will get an additional rotation and will no longer align with the wind.

The famous rotate with wind bug

It is a known problem of FS that the change in rotation will not always happen as soon as you change the wind direction in the weather menu. A fix for this is to place more then one object that rotate with the wind. When two of these objects are visible (on your screen) at the same time, it will work. If you only want to place one windsock for example you can best hide the others ones in buildings or so.