Page 1 of 1

Operating Cab Windows and Roof Hatch

Unread postPosted: Wed Apr 15, 2020 12:57 pm
by mikeadams2k
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.

Operating Cab Windows and Roof Hatch

Unread postPosted: Wed Apr 15, 2020 1:07 pm
by DigitalRails
+1
I would like to know how this works.

Re: Operating Cab Windows and Roof Hatch

Unread postPosted: Wed Apr 15, 2020 2:46 pm
by mrennie
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.

Re: Operating Cab Windows and Roof Hatch

Unread postPosted: Wed Apr 15, 2020 2:59 pm
by mikeadams2k
mrennie wrote:Here's an excerpt from one of my locos (UP119)......

Thank you very much! I'll give it a try.

Re: Operating Cab Windows and Roof Hatch

Unread postPosted: Fri Apr 24, 2020 4:30 pm
by mikeadams2k
mrennie wrote:Here's an excerpt from one of my locos......

Still no luck. I may have to pass on these features.

Re: Operating Cab Windows and Roof Hatch

Unread postPosted: Sun Apr 26, 2020 5:49 pm
by mikeadams2k
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.

Re: Operating Cab Windows and Roof Hatch

Unread postPosted: Mon Apr 27, 2020 4:38 am
by mrennie
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*!