Sign in to follow this  
Guest luissa

help ! API problem on wind rotation and I can't see it

Recommended Posts

I need some help to find out what is going on here.Before I rebuilt my machine I had a macro ( see attached ) doing a water fountain (or Flag) complete with wind rotation, conditional on direction and a nice waver courtesy of teh FS timer. I know the code needs cleaning up but it was working.After the rebuild I now get a flickering texture. It flickers between the transformed location ( rotated ) and the unrotated location ( N-S).In desparation I have progressively cut back the API and now am running the cut down version under. I still get the effect !Any clues ?ThxPatrick F>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Area( B %1 %2 22 ) mif( %12 ) IfVarRange( : 0346 %12 5 ) mifend PerspectiveCall( :Pos ) Jump( : ) :Pos mif( %11 ) RefPoint( 3 :End %1 %2 E= %11 V1= %10 V2= 208 ) melse RefPoint( 7 :End 1 %1 %2 V1= %10 V2= 208 ) mifend SetScaleX( :End 0 0 16 ) ; Scale=1 Call( :Begin ) :End Return :BeginTransformCall( :posWrotate2 0 0 0 0 0 0 0 0 C74 ) ;water jet position 2Return>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

Sorry code got cut short ?Current ( cut down ) api underArea( B %1 %2 22 ) mif( %12 ) IfVarRange( : 0346 %12 5 ) mifend PerspectiveCall( :Pos ) Jump( : ) :Pos mif( %11 ) RefPoint( 3 :End %1 %2 E= %11 V1= %10 V2= 208 ) melse RefPoint( 7 :End 1 %1 %2 V1= %10 V2= 208 ) mifend SetScaleX( :End 0 0 16 ) ; Scale=1 Call( :Begin ) :End Return :BeginTransformCall( :posWrotate2 0 0 0 0 0 0 0 0 C74 ) ;water jet position 2Return;-------:posWrotate2Points( 0 0 0 -63 ; 0 0 89 -63 ; 1 0 89 2 ; 2 0 0 2 ; 3)LoadBitmap( 0 L6 EF 0 0 0 ACT2k_wind.bmp )TexPoly( a 0 13 40 1 13 251 2 90 251 3 90 40 ) ;FrontTexPoly( a 3 90 40 2 90 251 1 12 251 0 12 40 ) ;BackReturnEndA

Share this post


Link to post
Share on other sites

The source looks correct to me. Rotation with the wind only seems to work when you have two objects visible on your screen that have such an animation. Could that maybe help you?

Share this post


Link to post
Share on other sites

And to add to Arno's reply - You should be close enough so the object will rotate. Objects using C74 variable rotate only when aircraft is close enough.Best regards,Goran BrumenFS Slovenija 2002 teamhttp://slovenia.avsim.net

Share this post


Link to post
Share on other sites

Thanks guys - but no joy. I was aware of these 2 issues before. The 2 objects using wind direction in the area has caught me before!!This is really wierd. The object ( in my case a simple wall with a texture on each side ) flicks very quickly on the screen between the rotated position and teh original ( north - south ) location.Every so often it stops for a bit but then starts again.I will do a test to unload scenery (thinking I may have 2 versions around ??)Alternativly has anyone got some working code ( or BGL ) of a simple wind orientated object and I'll try to see if it is machine related. I have already gone back to the old Airport and Scasm versions I had before teh rebuild to see if that helped - no joy regardsPatrick F

Share this post


Link to post
Share on other sites

Patrick, I just uploaded Harvey Field for 2k2...in it I included two objects that rotate with c74, a windtee and a windsock. I'm at work right now, and if you don't want to download the whole airport, I can send you the either the scasm or the bgl after I get home.I've been thinking about this, and I keep coming to the conclusion that this is hardware related...but I can't come up with why or what to do, so I haven't chipped in much.Good luck,Bob Bernstein

Share this post


Link to post
Share on other sites

Patrick,Poly( a 0 1 2 3 ) should only be used to draw "external" polygons. If, for example 0 1 2 3 were 4 vertex of a cube and if the RefPoint is in the center of the cube, then Poly( a 0 1 2 3 ) would draw the outer face of the cube, while Poly( ai 0 1 2 3 ) would draw the inner face.As far as I understand SCASM uses the first 3 points in the Poly argument (if you have 4, as it is the case, it is better that the 4th point is co-planar with the first 3) and calculates:- the coordinates a vector perpendicular to the plane defined by the 3 points, and pointing FROM the RefPoint ( a case ) or pointing TO the RefPoint ( ai case )- and the signed distance from the RefPoint to the planeComing to your example, SCASM will have a very difficult job since the 4 points and the RefPoint exist in the same plane! It will be difficult to know what are the TO and the FROM directions (eg, the side of the polygon that will be visible).So I would change your code as follows. The first block makes sure that your access to variable C74 allways work. In the rest you may need to change the sign in the 32767! If one is positive, the other one should be negative and vice versa!Regards, LuisArea( 5 d 0 0 255 )dwx( 3a 1e 0 0 0 1BA0 )SetScale( : 0 0 1 )IfVarAnd( : C76 0000 )EndAArea( B %1 %2 22 ) mif( %12 ) IfVarRange( : 0346 %12 5 ) mifend PerspectiveCall( :Pos ) Jump( : ) :Pos mif( %11 ) RefPoint( 3 :End %1 %2 E= %11 V1= %10 V2= 208 ) melse RefPoint( 7 :End 1 %1 %2 V1= %10 V2= 208 ) mifend SetScaleX( :End 0 0 16 ) ; Scale=1 ; Call( :Begin ) :BeginTransformCall( :posWrotate2 0 0 0 0 0 0 0 0 C74 );water jet position 2 :End Return;-------:posWrotate2Points( 0 0 0 -63 ; 0 0 89 -63 ; 1 0 89 2 ; 2 0 0 2 ; 3)LoadBitmap( 0 L6 EF 0 0 0 ACT2k_wind.bmp )TexPoly( m 0 0 32676 0 0 13 40 1 13 251 2 90 251 3 90 40 );FrontTexPoly( m 0 0 -32676 0 3 90 40 2 90 251 1 12 251 0 12 40 );BackReturnEndA

Share this post


Link to post
Share on other sites

Hi Luis,I use similar code for my trees and have never had such a problem. So I think it is not the problem of SCASM not knowing what front or aft is of the polygon. So I don't think that is the problem here.

Share this post


Link to post
Share on other sites

Here is code that works great...again, if your object worked until you rebuilt your box, and then didn't...this is logically a hardware problem. Cheers.Bob Bernsteinmif (0)Area( 5 %1 %2 1 )RotatedCall( :symbol 0 0 %5 )Jump( :endsymbl ):symbolRefPoint( 7 : 0.5 %1 %2 )Points( 0-10 0 -13-10 0 69 0 69 0 -130 0 -4)Poly( a 0 1 2 3 )Poly( a 0 4 3 )Return:endsymblEndAmifendArea( 5 %1 %2 22 )perspectivecall( :OBJ )shadowcall( :OBJ )jump( : ):OBJmif( %11 )refpoint( 2 :END %4 %1 %2 E= %11 v1= %10 %13 %14 )melserefpoint( 7 :END %4 %1 %2 v1= %10 %13 %14 )mifendTransformCall( :ROT 0 0 0 0 0 0 0 0 C74 )return:ROTcallLibobj( 0 B0B5568 44444444 AAAAAAAA 6 ):ENDreturnEndA

Share this post


Link to post
Share on other sites

thanks guys - I'll try anything at the momment !might be one to sleep on again.Patrick F

Share this post


Link to post
Share on other sites

>Hi Luis,>>I use similar code for my trees and have never had such a>problem. So I think it is not the problem of SCASM not knowing>what front or aft is of the polygon. So I don't think that is>the problem here.Hi Arno,Patrick uses Poly( a 0 1 2 3 ) and Poly( a 3 2 1 0 ). The 4 points and the RefPoint are in the same plane! What side of the polygon is drawn in each case?If I remember FSASM (old assembler) used the the "screw driver rule" to determnine the direction of the normal vector. But I think that SCASM only checks if RefPoint is in one 1/2 space defined by the 3 points or in the complementar half plane.Regards, Luis

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this