Controling fan rotation using LUA

Discussion of rolling-stock creation & re-painting.

Controling fan rotation using LUA

Unread postby PapaXpress » Wed Feb 06, 2013 1:08 am

I am trying to find a way to spin the radiator fan fast if the RPMs go up. I heard this can be done but so far Google is failing me. Does anyone know?
Image
"Just post some random unrelated text. We have members here who can help you with that." ~ Chacal
"When all else fails, read the instructions... if that doesn't work either, try following them." ~ Old Prof
Image
The Grade Crossing - Atlanta North Project - Virtual Rail Creations
User avatar
PapaXpress
 
Posts: 5147
Joined: Sat Oct 23, 2010 10:30 pm
Location: that "other" timezone

Re: Controling fan rotation using LUA

Unread postby Chacal » Wed Feb 06, 2013 1:13 am

Don't quote me on this, but I would make different animations with different speeds, then activate the desired animation in lua based on the engine RPM control value.
Over the hill and gathering speed
Chacal
Site Admin
 
Posts: 6492
Joined: Tue Jul 05, 2011 1:11 pm
Location: Quebec, Canada

Re: Controling fan rotation using LUA

Unread postby PapaXpress » Wed Feb 06, 2013 1:16 am

The only problem with that idea, is that the blueprint can only reference one animation file.
Image
"Just post some random unrelated text. We have members here who can help you with that." ~ Chacal
"When all else fails, read the instructions... if that doesn't work either, try following them." ~ Old Prof
Image
The Grade Crossing - Atlanta North Project - Virtual Rail Creations
User avatar
PapaXpress
 
Posts: 5147
Joined: Sat Oct 23, 2010 10:30 pm
Location: that "other" timezone

Re: Controling fan rotation using LUA

Unread postby BNSFdude » Wed Feb 06, 2013 1:33 am

I need the same, as well as the whole shutter idea. I'll drop reppo an email again.
Anthony Wood
Audio Engineer - Searchlight Simulations
User avatar
BNSFdude
 
Posts: 2721
Joined: Tue Nov 29, 2011 1:46 am

Re: Controling fan rotation using LUA

Unread postby Chacal » Wed Feb 06, 2013 1:36 am

Here are two in the Britkits Alco S3 engine blueprint:
Code: Select all
               <AnimSet>
                  <iAnimObjectRenderBlueprint-cAnimation d:id="34383200">
                     <AnimationID d:type="cDeltaString">Wipers</AnimationID>
                     <AnimationName d:type="cDeltaString">BritKits\Alco\RailVehicles\Diesel\RS3\Default\Engine\RS_wipers</AnimationName>
                     <AnimateInEditor d:type="cDeltaString">eTrue</AnimateInEditor>
                  </iAnimObjectRenderBlueprint-cAnimation>
                  <iAnimObjectRenderBlueprint-cAnimation d:id="34724200">
                     <AnimationID d:type="cDeltaString">Windows</AnimationID>
                     <AnimationName d:type="cDeltaString">BritKits\Alco\RailVehicles\Diesel\RS3\Default\Engine\RS_windows</AnimationName>
                     <AnimateInEditor d:type="cDeltaString">eTrue</AnimateInEditor>
                  </iAnimObjectRenderBlueprint-cAnimation>
               </AnimSet>


In this case, each animation is triggered by a control value set by pressing a key, but the control value could be set by the lua script.
Over the hill and gathering speed
Chacal
Site Admin
 
Posts: 6492
Joined: Tue Jul 05, 2011 1:11 pm
Location: Quebec, Canada

Re: Controling fan rotation using LUA

Unread postby PapaXpress » Wed Feb 06, 2013 2:03 am

So something like:


Code: Select all
   speed = Call( "GetSpeed" )
   if speed < 0.0 then
      speed = -speed;
    end

   Call ( "Fan_Exhaust_1:SetAnimationValue", speed * 10);
Image
"Just post some random unrelated text. We have members here who can help you with that." ~ Chacal
"When all else fails, read the instructions... if that doesn't work either, try following them." ~ Old Prof
Image
The Grade Crossing - Atlanta North Project - Virtual Rail Creations
User avatar
PapaXpress
 
Posts: 5147
Joined: Sat Oct 23, 2010 10:30 pm
Location: that "other" timezone


Return to Rolling-Stock Design

Who is online

Users browsing this forum: No registered users and 1 guest