BVE WorldWide
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Help with animation

3 posters

Go down

Help with animation Empty Help with animation

Post by phontanka 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?

Help with animation Bridge10
phontanka
phontanka

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

http://phontanka.wordpress.com

Back to top Go down

Help with animation Empty Re: Help with animation

Post by graymac 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.
graymac
graymac

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

http://www.celtictrainsim.com

Back to top Go down

Help with animation Empty Re: Help with animation

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

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

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

http://phontanka.wordpress.com

Back to top Go down

Help with animation Empty Re: Help with animation

Post by Dexter 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
Dexter
Dexter

Posts : 2153
Join date : 2011-07-08
Age : 38
Location : Brno, Czech republic

http://www.brnobve.eu

Back to top Go down

Help with animation Empty Re: Help with animation

Post by phontanka 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.
phontanka
phontanka

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

http://phontanka.wordpress.com

Back to top Go down

Help with animation Empty Re: Help with animation

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

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