Help with animation

View previous topic View next topic Go down

Help with animation

Post by phontanka on Sun Feb 12, 2017 12:47 am

I'd like to ask for some help with an animation. There is this bridge in the picture and on the bridge there is a train.

I'd like this train to slowly move towards the right, but only when it is within viewing distance from the driver's train. Once it has moved towards the right and the driver's train has passed it (or it gets out of viewing distance) it should disappear, so that if the driver returns to this point the train shouldn't be there again. Can anyone help me with this?


avatar
phontanka

Posts : 240
Join date : 2012-05-08
Location : Hungary

http://phontanka.wordpress.com

Back to top Go down

Re: Help with animation

Post by graymac on Sun Feb 12, 2017 1:32 pm

It seems your problem is partly the same as the road traffic over bridges which I use in the Irish routes (which is based on NWM code, they did it first). And partly the same as the approach control I use for crossing gates and and their "distant" signals. Not sure how to write the combined formula though.

A "Animated Cookbook" would be very useful. All I've had to work with was the original OpenBVE "Demo Route" with examples of code.
avatar
graymac

Posts : 1737
Join date : 2011-08-28
Location : Co Mayo, Eire

http://www.celtictrainsim.com

Back to top Go down

Re: Help with animation

Post by phontanka on Sun Feb 12, 2017 2:25 pm

Yes, step by step tutorials would be useful.
avatar
phontanka

Posts : 240
Join date : 2012-05-08
Location : Hungary

http://phontanka.wordpress.com

Back to top Go down

Re: Help with animation

Post by Dexter on Sat Feb 25, 2017 7:42 am

I have done the same within my route, the only difference is the moving object on the bridge was a lorry. See this:
Code:
[object]
Position = 0, 0, 0
states = Axor.csv
RotateYFunction = 1.571
TranslateXFunction= if[trackdistance[0]<450 & trackdistance[0]> -300, -(0.75)*trackdistance, 0]

This one would be going left, due to minus in front of 0.75. The rotation function is applied because of the way the original obect was created - if it wasn't there, the lorry would be "sidesaddling" Very Happy. The "(0.75)" in this case influeneces the speed of the car movement. If you want your train on the bridge to move slowly, you will have to put a lower number instead.
Any questions - let me know.
Hope this helps. Smile
avatar
Dexter

Posts : 1791
Join date : 2011-07-08
Age : 31
Location : Brno, Czech republic

http://www.brnobve.eu

Back to top Go down

Re: Help with animation

Post by phontanka on Sat Mar 11, 2017 3:26 pm

Thanks a lot, I'll give it a try as soon as I find time to get to it.
avatar
phontanka

Posts : 240
Join date : 2012-05-08
Location : Hungary

http://phontanka.wordpress.com

Back to top Go down

Re: Help with animation

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum