Operating Cab Windows and Roof Hatch

Discussion of rolling-stock creation & re-painting.

Operating Cab Windows and Roof Hatch

Unread postby mikeadams2k » Wed Apr 15, 2020 12:57 pm

Hello, i'm getting close to finishing the cab for the Allegheny. I have the windows and roof hatch operating from inside the cab. I'm trying to get them to display their open positions from the outside view. I've been looking at a number of blueprints from other engines that have these features and have tried to imitate their blueprint (and script) entries, but, I'm still unable to get it to work. I've tried the external animation function on the roof hatch and am able to get the hatch to display open, but only after I've opened it several times. Also, it will not close. Any help would be greatly appreciated.
mikeadams2k
 
Posts: 194
Joined: Thu Mar 04, 2010 12:26 am
Location: Ocala, FL

Operating Cab Windows and Roof Hatch

Unread postby DigitalRails » Wed Apr 15, 2020 1:07 pm

+1
I would like to know how this works.
Last edited by DigitalRails on Mon Jun 01, 2020 11:49 am, edited 1 time in total.
DigitalRails
 
Posts: 107
Joined: Fri Aug 23, 2019 1:06 pm

Re: Operating Cab Windows and Roof Hatch

Unread postby mrennie » Wed Apr 15, 2020 2:46 pm

Here's an excerpt from one of my locos (UP119). The key to the external animation is to call "AddTime" to advance the animation by the right amount.

Code: Select all

gCabWindowFL = 0.0
gPrevCabWindowFL = 0.0
WINDOW_ANIM_SENSITIVITY = 4

function UpdateCabWindowFL()

   gCabWindowFL = GetControl("CabFrontWindowL")

     
   if gCabWindowFL ~= gPrevCabWindowFL then

      
      local increment = (gCabWindowFL - gPrevCabWindowFL)*WINDOW_ANIM_SENSITIVITY
      Call ("AddTime", "CabFrontWindowL", increment)

      gPrevCabWindowFL = gCabWindowFL

   end
end -- function UpdateCabWindowFL



You would call the function from your main Update callback function.

"CabFrontWindowL" is the name of the control value for the left-hand windows and it's also the name I gave to the window animation in the engine blueprint.

The value of WINDOW_ANIM_SENSITIVITY depends on how the animation is done. You might need to experiment with it to get the external animation to be in sync with the internal one.
User avatar
mrennie
 
Posts: 3214
Joined: Wed May 30, 2012 12:22 pm

Re: Operating Cab Windows and Roof Hatch

Unread postby mikeadams2k » Wed Apr 15, 2020 2:59 pm

mrennie wrote:Here's an excerpt from one of my locos (UP119)......

Thank you very much! I'll give it a try.
mikeadams2k
 
Posts: 194
Joined: Thu Mar 04, 2010 12:26 am
Location: Ocala, FL

Re: Operating Cab Windows and Roof Hatch

Unread postby mikeadams2k » Fri Apr 24, 2020 4:30 pm

mrennie wrote:Here's an excerpt from one of my locos......

Still no luck. I may have to pass on these features.
mikeadams2k
 
Posts: 194
Joined: Thu Mar 04, 2010 12:26 am
Location: Ocala, FL

Re: Operating Cab Windows and Roof Hatch

Unread postby mikeadams2k » Sun Apr 26, 2020 5:49 pm

mikeadams2k wrote:
mrennie wrote:Here's an excerpt from one of my locos......

Success! After trying a slightly different approach, I was able to get the exterior windows and hatch operating in conjunction with their interior counterparts. Thanks so much for the script and the tip on experimenting with the WINDOW_ANIM_SENSITIVITY value.
mikeadams2k
 
Posts: 194
Joined: Thu Mar 04, 2010 12:26 am
Location: Ocala, FL

Re: Operating Cab Windows and Roof Hatch

Unread postby mrennie » Mon Apr 27, 2020 4:38 am

mikeadams2k wrote:
mikeadams2k wrote:
mrennie wrote:Here's an excerpt from one of my locos......

Success! After trying a slightly different approach, I was able to get the exterior windows and hatch operating in conjunction with their interior counterparts. Thanks so much for the script and the tip on experimenting with the WINDOW_ANIM_SENSITIVITY value.


I'm glad you got it working :)

!*cheers*!
User avatar
mrennie
 
Posts: 3214
Joined: Wed May 30, 2012 12:22 pm


Return to Rolling-Stock Design

Who is online

Users browsing this forum: No registered users and 1 guest