Jump to content
Sign in to follow this  
Guest GerrishGray

rotating trees

Recommended Posts

Guest

Hi, I having been searching the forum for a way to rotate trees to the aircraft. The code I found reads...SCALE_AGL OBJECT_0_RETURN, 10000, 27, 131072, 0006218AFh, 012D8h, 0A00C3A31h, 08BE3h, 0, 0BGL_CALL OBJECT_0_BEGINOBJECT_0_RETURN label wordthen becomes:SCALE_AGL OBJECT_0_RETURN, 10000, 27, 131072, 0006218AFh, 012D8h, 0A00C3A31h, 08BE3h, 0, 0BGL_SPRITE_VICALL OBJECT_0_BEGIN, 0, 0, 0, 0, 0, 0, 0, 1, 0 hereOBJECT_0_RETURN label wordbut...the asm code I generate reads...SCALE_AGL OBJECT_0_RETURN, 10000, 4, 131072, 00055EFCCh, 061A9h, 0FF3598CFh, 0A6EBh, 0, 0INSTANCE_CALL OBJECT_0_BEGIN, 0, 0, 04000hOBJECT_0_RETURN label wordCould somebody offer some advice on this.Thanks David

Share this post


Link to post
Share on other sites

Hi David.You gave this code:SCALE_AGL OBJECT_0_RETURN, 10000, 27, 131072, 0006218AFh, 012D8h, 0A00C3A31h, 08BE3h, 0, 0BGL_SPRITE_VICALL OBJECT_0_BEGIN, 0, 0, 0, 0, 0, 0, 0, 1, 0 hereOBJECT_0_RETURN label wordI think it should have been:SCALE_AGL OBJECT_0_RETURN, 10000, 27, 131072, 0006218AFh, 012D8h, 0A00C3A31h, 08BE3h, 0, 0SPRITE_VICALL OBJECT_0_BEGIN, 0, 0, 0, 0, 0, 0, 0, 1, 0OBJECT_0_RETURN label wordThen this looks possible:SCALE_AGL OBJECT_0_RETURN, 10000, 4, 131072, 00055EFCCh, 061A9h, 0FF3598CFh, 0A6EBh, 0, 0SPRITE_VICALL OBJECT_0_BEGIN, 0, 0, 0, 0, 0, 0, 0, 1, 0OBJECT_0_RETURN label wordThat "1" in the # 9 parameter is a non-"0"... and that is in the heading position of the call... so possibly the heading is always facing you? I think if parameter#5 is 1, the object is always pitching at you from above or below. #7 is for the object to be banked at you ( clocklike rotation? ).Parameters 2,3,& 4 should be the normal rotation of the object, just like INSTANCE_CALL.I'm curious as to what all those parameters actually do, so if you find out, let us know.Here's the internal BGLC macro:; -----------------------------------------------------------------------------; SPRITE_VICALL - This command will always rotate the object toward the eye. It; works as follows:; 1. xx,yy,zz are subtracted from current visual_position.x/y/z; 2. object is rotated in heading if hh is non-zero and then; hh is added to the new heading; 3. hv is gotten if non-zero and added to new heading; 4. object is rotated in bank if bb is non-zero and then; bb is added to the new bank; 5. bv is gotten if non-zero and added to new bank; 6. object is rotated in pitch if pp is non-zero and then; pp is added to the new pitch; 7. pv is gotten if non-zero and added to new pitch; 8. object is then instanced and displayed;; Entry: subroutine = relative offset to the BGL subroutine; xx,yy,zz = offset for rotate at; pp,bb,hh = fixed PBH to add to rotated object (each of; these must be non-zero to rotated that axis; toward the eye); pv,bv,hv = offset into current var block to get pbh to; rotated. This is done even if the axis is not; rotated to the eye.; -----------------------------------------------------------------------------SPRITE_VICALL macro subroutine,xx,yy,zz,pp,pv,bb,bv,hh,hv local startstart label word dw 0A7h dw (offset subroutine)-(offset start) dw xx,yy,zz XYZ16 {pp,bb,hh} XYZ16 {pv,bv,hv} ERRS16 (offset subroutine)-(offset start) endmIf you want to look at the insides of BGLC, I recommend ResourceHacker. Just drag'n'drop BGLC.exe onto it's icon, and it will show you all the internal structure of BGLC. Great learning tool for BGLC.For example, the above code is within BGLC... and "dw 0A7h" is the opcode of the command. If you look up (0xA7) in the fs2000 scenery SDK, it will direct you to BGL_SPRITE_VICALL ( note the name is actually SPRITE_VICALL.. who knows why the SDK lists it this way ).Dick

Share this post


Link to post
Share on other sites
Guest

Hi Dick,The examples I gave are from a discussion in the forum, I think they were given by Arno.I could have the wrong end of the stick here, or I have not twigged the correct way to rotate trees.The way I thought was correct was to create the object in gmax, export the file and select "keep files", then the code in the example would be in the resulting *.asm file.Maybe I'm wrong?Thanks David

Share this post


Link to post
Share on other sites
Guest

Don't know how or why, but I did today what I did 20 times yesterday, and the code was generated as the examples.Strange?I thought I was barking up the wrong tree and it was beginning to sap my patience.David

Share this post


Link to post
Share on other sites

STOP IT, David!!"I thought I was BARKING up the wrong TREE and it was beginning to SAP my patience."Your killing me here!:-lol

Share this post


Link to post
Share on other sites
Guest

Sorry, but it almost had me stumped.(last stupid pun, honest)

Share this post


Link to post
Share on other sites
Guest

Man, you are really going out on the limb by saying that.....

Share this post


Link to post
Share on other sites
Guest EdrickV

An easier way to make trees that always face the player might be to use Easy Object Designer. Took me about 5 minutes to make the below example, once I fixed an annoying problem EoD has. (It doesn't seem to like DXT textures and the one I chose for my test happened to be DXT so I saved 32-bit versions in EoD's Data folder but left the DXT textures in the FS2k2 texture folder.) It was made using a 2 sided wall, but you could probably just use one side.;macrodesc Test Tree;defaultscale 1;textures tree_conic.bmp,tree_conic_WI.bmp,tree_conic_FA.bmp,tree_conic_SP.bmp,;designshape -5,0,-5,0,4,0,4,0;--------------------------------------------; Filename: TestTree.api; Project: ; Designer: EdrickV; Date: 03-03-21; Update: 03-03-21; Credits: ; Macro generated using EOD 2.0.59; Any commercial distribution or use of this file is prohibited;--------------------------------------------; %1 = Latitude; %2 = Longtitude; %4 = Not used [RefpointScale=1, ObjectScale=0.25]; %5 = Rotation; %6 = Not Used; %7 = Not Used; %8 = Not Used; %9 = Not Used; %10 = Visibility range; %11 = Altitude; %12 = Detail level; 106 = Radial visibility range (*2); %15 = User definedArea( B %1 %2 22 ) mif( %12 ) IfVarRange( : 0346 %12 5 ) mifend PerspectiveCall( :Pos ) ShadowCall( :Pos ) Jump( : ) :Pos mif( %11 ) RefPoint( 3 :End %1 %2 E= %11 V1= %10 V2= 106 ) melse RefPoint( 7 :End 1 %1 %2 V1= %10 V2= 106 ) mifend SetScaleX( :End 0 0 14 ) ; Scale=0.25 mif( %5 ) RotatedCall( :Begin 0 0 %5 ) melse Call( :Begin ) mifend :End Return :Begin VectorJump( :West 32767 0 0 0 ) VectorJump( :SouthEast 0 0 32767 0 ):NorthEast RotateToAircraft( :part000 0 0 0 0 0 1 0 0 0 ) ; Return:SouthEast RotateToAircraft( :part000 0 0 0 0 0 1 0 0 0 ) ; Return:West VectorJump( :SouthWest 0 0 32767 0 ):NorthWest RotateToAircraft( :part000 0 0 0 0 0 1 0 0 0 ) ; Return:SouthWest RotateToAircraft( :part000 0 0 0 0 0 1 0 0 0 ) ; Return;-------:part000; wall - Wall 1Points( 0 18 0 0 ; 0 18 50 0 ; 1 -17 50 0 ; 2 -17 0 0 ; 3)LoadBitmap( 0 WFS6 EF 0 0 0 tree_conic.bmp )BitmapMode( 1 ) ; transparentTexPoly( a 0 0 0 1 0 255 2 254 255 3 254 0 ) ;FrontBitmapMode( 0 )BitmapMode( 1 ) ; transparentTexPoly( a 3 0 0 2 0 255 1 254 255 0 254 0 ) ;BackBitmapMode( 0 )ReturnEndASaid tree appears, rotates to face the aircraft, (which means it looks like it doesn't rotate at all) is properly transparent, and varies with the season. :)"Let me help you out. You're cleared to taxi any way you can to any runway you see."

Share this post


Link to post
Share on other sites
Guest GerrishGray

Now isn't that interesting ...To be frank, the best way of using my tree textures is in combination with the Trees Library that they come from. The code built into the library is a good deal more efficient, reasonably well optimised for FS2000/FS2002, and offers a number of improved features such as more sophisticated seasonal behaviour etc.The library is Freeware and can be downloaded from this site (and many others) as the archive trees_v3.zip. I don't mind people using the textures (or code) for their own macros and experiments, but it's nice when they have the courtesy to let me know about it, or are at least polite enough to acknowledge the source. Like most Freeware authors, I put a great deal of effort into my work and the only reward we get is to know that we are giving pleasure to the rest of the FS community. Only a very small proportion of users ever bother writing to say thank you, but it's the only tangible reward we ever get ... and the greatest annoyance we suffer is seeing others plagiarise our work and ideas without acknowledgment.I know many authors who end up despairing whether it is even worth the effort of publishing their work as Freeware because of the lack of acknowledgment. Some end up turning to Shareware instead to make sure that they get some small acknowledgment and reward (although there is rarely much profit involved) and probably then have to suffer abuse from those who don't like the idea of having to pay, but couldn't be bothered to say a simple thankyou when it was free!Please don't take undue offence, but it would be well to remember that a thank you or acknowledgement is always appreciated, and can help ensure that freeware goodies are available as an ongoing resource for all to enjoy.Kind RegardsGerrish(author of the Trees Library)

Share this post


Link to post
Share on other sites
Guest

Afer long break ....Found this thread from the past and I followed the example successfuly. Group of the poligonal trees (3) appeared in FS and rotated faces towards the observer but on one common pivot. I am still seeking the way to rotate EACH tree poligon in the group independently (on 3 pivots). I know how to do it in gMax, however when I edit the *.asm file I still find only one statement BGL_CALL OBJECT_0_BEGIN to replace and entire group remains connected. I have come to pretty nifty and fast way to make multi-tree and randomized forrest using "array" command in gMax. It is crucial however that I have problem described above under control, otherwise thing may not look so real.Ted

Share this post


Link to post
Share on other sites

I think this is possible if you first export from GMax without selecting optimize. After that you can recognize the individual trees in the _0.asm file and then for each of them you would need to add a RotateToAircraft command.


Arno

If the world should blow itself up, the last audible voice would be that of an expert saying it can't be done.

FSDeveloper.com | Former Microsoft FS MVP | Blog

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  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...