animated files? here's the info you need!
Page 1 of 1
animated files? here's the info you need!
hello everyone! i have noticed a few people needing help with a few bits and bats around coding, and im hoping over the next few week i will be able to make a proper tutorial! but until then i thought i would explain a bit about how things work, feel free to comment back and ask questions and me and another few experienced developers will be happy to try help you through a few problems
---------------------------------------- overview and sections ------------------------------------
well here's a bit of easy reading and explanation of a few area's on Michelle's site.
- Code:
[Include]
basically it does what it says on the tin, if you wish to include another .CSV , .b3d & .ANIMATED file you would just pop include into a animated file basically to tell the program you wish to include which ever file you need.
< mark 4 coach with no door's.ANIMATED>
[Include]
a door.csv
- Code:
FileName0
FileName1
FileName2
...
This is not actual coding, but actually refer's to what file you wish to include like above.
< mark 4 with no door's.ANIMATED>
[Include]
a door left front.csv
a door right front.csv
a door left back.csv
a door right back.csv
- Code:
Position = X, Y, Z
so lets recap, so far we have the mark 4 coach with no doors in one csv, then we have made 4 other csv's with a door in each facing the way they should relevant to the coach it's self. we have 1 .ANIMATED file which now has the > include < section and then all the different door .csv's. now we need to move then into place, this is where this coding comes into play. if you have good knowledge of coding this should not be hard to explain.
X,Y,Z = left,right ,, up and down ,, forward and backwards
now that's the overview (No.1) section explained a bit more simpler. now section 2
You can use the [Object] section to create a single animation. This requires to set up at least one state via the States parameter, and to use any combination of functions you want, which provide control over the animation. There can be any number of [Object] sections within the file.
so this is a quick explanation of the power which the [object] in the .ANIMATED file can do. when she explains that at least one state needs to be made via the states parameter is because if you don't, you may as well use the [include] as this will work for placing an object instead of wanting to animate it. when you see the explanation that you may wish to use as many functions as possible its basically explaining that if you wished to make the door open forward, and then slide back, you can. although the coding for that is not on the site it doesn't mean its not possible.
so now lets give things a try!
- Code:
[Object]
- Code:
Position = -1.5,0,-7
basically the first is -1.5 meters to the left of the car ( or what ever the side of the car is in the original .csv) , the second is 0 because the doors should not site higher or lower than the car, and the third being towards the rear end of the car (this is for a centered car ONLY!! if your car is built from o to 24 and not -12 to 12 in length then adjustments will need to be made)
- Code:
States = File0, File1, ..., Filen-1
well this is where you state what you are wanting to use in the formula you are creating. if you wished to make a flashing light then you would use two .csv's one with a light showing, and one with it not showing. then pop them into the code, but in this case its the front left door. so it would be as follows.
- Code:
States = frontleftdoor.csv
now the hard part, it took me 2 weeks of maths, thinking and brain microwaving to figure this out and will be hard for me to explain even though i actually figured the coding out. so there may be errors and i can not confirm the following due to me writing this without looking in depth to the animation today and loading things up and testing things out. but from my countless weeks of head aches i can and will do my best to explain.
so lets look at what we got in our .ANIMATED file so far
- Code:
[Object]
Position = -1.5,0,-7
States = frontleftdoor.csv
so we have a boring door sat there now on our carriage with no animation, now here is the animation.
please note the coding below would not be for the mark 4 coach stock, they use slam closing doors, the coding is for bi parting plug-in doors.
- Code:
TranslateXFunction = min[leftDoors,0.1]
X = left and right. so
- Code:
min
- Code:
-min
- Code:
[leftdoors]
so now we have a door that now comes out when the key is pressed. but apart from coming outwards we need her to now slide out the way so the heavier kind of passenger can get in! this is where the next bit of coding comes in handy.
- Code:
TranslateZFunction = leftdoors[0]
same again ,
- Code:
Z
forward or backwards
- Code:
leftdoors
the simulations key press command
- Code:
[0]
makes the door move downwards away from the door by the size of the door itself.
- Code:
[1]
makes the door move upwards by the size of the door in the .csv
so now the full coding should be like this
- Code:
[Object]
Position = -1.5,0,-7
States = frontleftdoor.csv
TranslateXFunction = min[leftDoors,0.1]
TranslateZFunction = leftdoors[0]
now above is a re post of a a comment in Gray's section, and had actually explained how to make a door. so now i will continue on with explaining as much more of the ANIMATED file as i can, so lets continue..
- Code:
RotateXDirection = X, Y, Z
RotateYDirection = X, Y, Z
RotateZDirection = X, Y, Z
- Code:
RotateXFunction = Formula
RotateYFunction = Formula
RotateZFunction = Formula
now the two above items are both for rotate, and if you look closely you will see one with a formula and one with the co-ordinates. well the formula is what ever type of command you make for that item, and the key command (example being leftdoor for the f5 key etc..) for when it is used, and then the co-ordinates for you to manually explain to the simulator what you want to happen.
- Code:
TextureShiftXDirection = X, Y
TextureShiftYDirection = X, Y
this is what it says on the tin, shifting the texture you decide to shift in which ever direction you wish to move "shift it" to. but remember this would be in a piece of coding and not used as a single command.
try to think of an old bus, and the driver had a little metal piece sticking out above the window section which he spun around for him to select the destination? well this can be used like that
- Code:
RefreshRate = Seconds
now this is simple, although this does not help does it ?
This defines the minimum amount of time that needs to pass before the functions are updated. A value of 0 forces the functions to be updated every frame. Please note that objects outside of the visual range might be updated less frequently regardless of this parameter. Use RefreshRate when you don't need a perfectly smooth animation (in order to optimize performance), or when you deliberately want the object to be only updated in fixed intervals.
so basically you but the amount of seconds per face that is shown , then followed by the amount of faces which are actually in the slide show. but yet again with nearly every type of animation in openbve, it is not used singly, and has to be a part of a command, but dont worry as always ill explain with coding.
- Code:
[Object]
Position = 0, 0, 0
States = header1.csv,header2.csv
statefunction = Mod[value + pluginstate[20], 2]
RefreshRate = 6
lets break it up
- Code:
[Object]
Position = 0, 0, 0 - the posistion
States = header1.csv,header2.csv - stating which files your wanting shown
statefunction = Mod[value + pluginstate[20], 2] - now ill explain this underneath in more detail
RefreshRate = 6 - here she is! telling the simulator that your wanting a 6 second wait per file that's shown.
now this is a PLUG IN SPECIFIC ITEM AND WILL NOT WORK ON ANY NON UK PLUG IN'S THE SAME WAY
statefunction = Mod[value + pluginstate[20], 2] - now ill explain this underneath in more detail
so straight away we have our state function section, the we have a mod, which means where about to modify the section of the coding. then we have the value, meaning where about to add an addition to the coding which is the pluginstate , in this case plug in state [20] which on the uk plugin is key 5 (although off the top of my head im not sure if this is right so look out for an edit or two), now this mean;s when our plugin state (our key is pressed) we then override that function making it stop on which ever file its on. and then press again to continue the process
Lists 3 to 6 are not really in need of explaining, if you don;t understand them i would advise asking around for bits of information, but mostly they explain a few things, and are to be added to commands, but a rarely seen anyway so not really a big issue.
___________________________________________________________________________________________________________________
now a few examples for you all to overlook ;
this is a header file in which two files can be changed;
- Code:
[Object]
Position = 0, 0, 0
States = header1.csv,header2.csv
statefunction = Mod[value + pluginstate[20], 2]
RefreshRate = 6
you can change both the amount of faces that you wish to have their and and on the state function there is a 2 on the end, now the amount of files you wish to have in the states = file,0,1,2,... section that amount needs to be put there;
States = 0,1,2,3,4,5
now put the amount here ;
statefunction = Mod[value + pluginstate[20],***** 6*****] dont put the stars though
- Code:
[Object]
Position = 0, 0, 0
States = 350-1.csv, 350lights1.csv, 350lights2.csv, 350lights3.csv
statefunction = pluginstate[20]
[Object]
Position = 0, 0, 0
States = 350-1.csv, 350lights1.csv, 350lights2.csv, 350lights3.csv
statefunction = pluginstate[17]
this is for lights, and here's the MOD again ,and another 2 plug in states, [20] key number 5 and [17] key number 4
now the proper plug in door commands! these doors even in real life work as a team both pop outwards and then one slides towards the front, and one towards the back. in the case of the coding below the first code section pops out the towards the fron of the train and the second towards the back of the train.
- Code:
[Object]
Position = 0, 0,0
States = left3.csv
TranslateXFunction = min[leftDoors,0.1]
TranslateZFunction = -leftdoors[0]
RefreshRate = 0.01
[Object]
Position = 0, 0, 0
States = left4.csv
TranslateXFunction = min[leftDoors,0.1]
TranslateZFunction = leftdoors[0]
RefreshRate = 0.01
now wait a minute? thts only the left side section! what about the right side? don't worry ill make your life a little bit more easier;
- Code:
[Object]
Position = 0, 0,0
States = right4.csv
TranslateXFunction = -min[rightDoors,0.1]
TranslateZFunction = -rightdoors[0]
RefreshRate = 0.01
[Object]
Position = 0, 0, 0
States = right3.csv
TranslateXFunction = -min[rightDoors,0.1]
TranslateZFunction = rightdoors[0]
RefreshRate = 0.01
now wheels right ?
- Code:
Position = -0.72, 0.42, 1.12
states = bogieleft.csv
RotateXFunction = value + delta * speedometer / 0.625
loads of jargon again? ill try explain below
Position = -0.72, 0.42, 1.12 - where you are wanting the wheel on the train (bearing in mind you already made the external with bogies with no wheels first)
states = bogieleft.csv - the left hand wheel which you have already made ( im not doing everything for you )
RotateXFunction = value + delta * speedometer / 0.625 - now everything upto the / is telling the simulator its the roatation of the wheel to accordance of the speedometer, if your in a 66 spinning its wheels, these wheels will be spinning at that speed! even though your going no where!
now the /0.625 is the circumference of the wheel.
now everybody! i hope this helps !!
special k!
maybe this could be a sticky?
[center]
Last edited by mrknowitall on Sat Sep 24, 2011 12:59 pm; edited 1 time in total (Reason for editing : added a starter paragraph)
mrknowitall- Posts : 824
Join date : 2011-07-09
Age : 32
Location : W. Yorkshire
Similar topics
» Animated files coding
» Issue with TrackFollowerFunction in .Animated files
» Sounds with .animated files
» Some much needed functions for train .animated files
» [Sound] section in .animated files *for trains* not working
» Issue with TrackFollowerFunction in .Animated files
» Sounds with .animated files
» Some much needed functions for train .animated files
» [Sound] section in .animated files *for trains* not working
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum