BVEStation

Author Topic: Creating 3D Cabview for OpenBVE  (Read 5304 times)

Offline Manuel18

  • New Recruit
  • *
  • Posts: 35
  • Gender: Male
  • BVEStation Member
    • View Profile
    • OpenBVE Venezuela and High Speed Trains development
Creating 3D Cabview for OpenBVE
« on: February 14, 2015, 09:24:52 pm »
Asuming you know modelling you need it for this.

-------------
Chapter one "Design Interior for it"
-------------

I recommend to modelers avoid creating the passenger interior area and repaint the cab door on black without transparent.

at this chapter don't create any control or display of the panel just the shape of it.

NOTE: I recommend modelers create the train first and next the CAB not backwards lol

-------------
Chapter two "Building the panel.animated"
-------------
This is the most extensive part of the work and maybe the most frustrating one.

Panel.animated is the same as like an animated of the train. it can use translate or rotate command also include command.

creating a Panel.animated you also use notepad or notepad++ for work more confortable.

the Panel.animated should contain this code at next.

INTRODUCTION
------------------------------
;Created by Me for BVEStation users;       <<< Comments section with semicolons start and end (if you want really to do it lol)

[include]               <<< We use an include because the object don't need to move (static object only)
DeskandShit.csv   <<< As name already say is the Desk windows wiper and other stuff than are static and don't need to included apart of a object.
position = 0,0,0  <<< defined by X,Y,Z coordinates on METERS!

;;;REAL CODE UNTIL NOW;;;
-------------------------------------
;Created by Me for BVEStation users;
[include]
DeskandShit.csv
position = 0,0,0

-------------
Chapter three "Understanding animated files and basic formulas"
-------------

[object]  <<< We use an object because the object will need to move or change states---

states = OFF.csv , ON.csv   <<< States of the object in this case we are defined by two states (if the door is opened it will turn on the light) so it can be backwards (if the door is closed it will turn on the light)

statefunction = DOORS  <<< name of the command /formula - OpenBVE on the most cases use boolean formulas to it.

--------------------
Formula list
-------------------
http://www.bveklub.hu/developing/object_animated.html#variables


Another example of this, two individual lights than may be interpreted as Door Opened and Door closed and could be used but you need to create a light turned off on the deskandshit.csv and the turned on light should be a bit more tall and width than the deskandshit.csv panel light or we will get overlap trouble.


NOTE: We asume you are using the correct textures illuminating on night with (setemissivecolor - emissivecolor) commands not only for panel also on state models. To be honest it's just playing with lights if we have two states.


TranslateZFunction =  powerNotch * 0.2   << an Nice formula - Meters ONLY

--------------------
Formula list
-------------------
http://www.bveklub.hu/developing/object_animated.html#variables
 

NOTE: TranslateZfunction is only for Z axis you can use TranslateYfuction or TranslateXfunction for Y and X axis, Translate Function an this section use 0.2 meters per every notch. so it will increase 1 meter if we have 5 notches...


RotateXFunction =   -2.11 + abs[speedometer] * 0.155  <<< Name of the command - RADIANS ONLY for rotate object



In this case we asume a value as -2.11 radians to start the needle on the 0 kmh or mph position

"abs" Absolute value or abs on the formula that math command avoid to negative numbers be negative and convert it only on positive one.

If we don't use Abs and if we go backwards on simulation the speed will be negative and the needle will rotate under 0 mph

"speedometer * 0.155"  every m/s per radian  on rotation..

NOTE: Same for X,Y,Z Translate case if you want to do it on Z axis just change the axis on command line

you can see the needle rotating on Clockside correctly as most of cases if you have the needle rotating on counter clockside you have only one option.

You can add "rotatexdirection = -1, 0, 0" line if you are using the Xaxis
You can add "rotateydirection = 0, -1, 0" line if you are using the Y axis
You can add "rotatezdirection = 0, 0, -1" line if you are using the Z axis


position = 0,0,0  <<< defined by X,Y,Z coordinates , You can do the model centered at world and then position correctly with this command or do the model centered at cabview.

Please for FORMULA commands use the link bellow to see all commands for Animated Commands
http://www.bveklub.hu/developing/object_animated.html#variables

NOTE: needles and controls doesn't need more than ONE STATE

;;;REAL CODE UNTIL NOW;;;
-------------------------------------
;Created by Me for BVEStation users;
[include]
DeskandShit.csv
position = 0,0,0

[object]
states = LightOFF.csv , LightON.csv
statefunction = leftdoors
position =  0,0,1

[object]
states = LightOFF.csv , LightON.csv
statefunction = rightdoors
position =  0,2,1

[object]
states = accelerator.csv
TranslateZfunction = powernotch * 0.1
position =  0.5,2,1

[object]
states = needle.csv
TranslateZfunction = -2.11 - abs[speedometer] * 0.115
rotatezdirection = 0, 0, -1
position =  0.5,2,1


[object]
states = needle2.csv
TranslateZfunction = -2.11 - abs[brakepipe] * 0.115
rotatezdirection = 0, 0, -1
position =  0.5,2,1
-------------
Chapter four "complex formulas"
-------------
As my masterpice the Bombardier M7 and the Kawasaki M8 for OpenBVE it use complex formulas with boolean results.

Digital speedometer

to right to LEFT

1st digit
[object]
States = 0.csv,1.csv,2.csv,3.csv,4.csv,5.csv,6.csv,7.csv,8.csv,9.csv
stateFunction = Abs[floor[speedometer * 3.6, 10]]

Floor = Rounds down to the nearest integer.

3.6 = Value to transform the speedometer m/s into km/h then for miles you can use "2.23693629" value.

10= Represent the numer of states of the object

--- Now we have a speedometer for a runner or a human but not for a tiger ----

2nd digit use this line
stateFunction = Abs[floor[speedometer * 3.6, 100] * 0.1]

3rd digit use this line
stateFunction = Abs[floor[speedometer * 3.6/100]]

However you don't need reach speed of sound to get a 4th digit haha[/size]

--BOOLEAN and MATH OPERATIONS--
an example of this

[object]
States = OFF.csv,ON.csv
stateFunction = leftdoor | rightdoor

True (1 or ON) if any of leftdoor or rightdoor are true (opened)

[object]
States = OFF.csv,ON.csv
stateFunction = ReverserNotch > 0

it will only activate if the reverser notch is great than 0

for math and boolean understand visit the link bellow
http://www.bveklub.hu/developing/object_animated.html#operators

NOTE : STATEFUNCTION doesn't accept negative boolean values
if we apply ReverserNotch without "> 0 or < 0"  it will dissapear on backward position


;;REAL CODE UNTIL NOW;;;
-------------------------------------
;Created by Me for BVEStation users;
[include]
DeskandShit.csv
position = 0,0,0

[object]
states = LightOFF.csv , LightON.csv
statefunction = leftdoors
position =  0,0,1

[object]
states = LightOFF.csv , LightON.csv
statefunction = rightdoors
position =  0,2,1

[object]
states = accelerator.csv
TranslateZfunction = powernotch * 0.1
position =  0.5,2,1

[object]
states = needle.csv
TranslateZfunction = -2.11 - abs[speedometer] * 0.115
rotatezdirection = 0, 0, -1
position =  0.5,2,1


[object]
states = needle2.csv
TranslateZfunction = -2.11 - abs[brakepipe] * 0.115
rotatezdirection = 0, 0, -1
position =  0.5,2,1

[object]
states = emergencybutton.csv
TranslateYfunction = emergencybrake * -0.1
position =  0.5,2,1

;;digit 1;;
[object]
States = 0.csv,1.csv,2.csv,3.csv,4.csv,5.csv,6.csv,7.csv,8.csv,9.csv
stateFunction = Abs[floor[speedometer * 3.6, 10]]
position =  0.5,2,1

;;digit2;;
[object]
States = 0.csv,1.csv,2.csv,3.csv,4.csv,5.csv,6.csv,7.csv,8.csv,9.csv
stateFunction = Abs[floor[speedometer * 3.6, 100] * 0.1]
position =  0.4,2,1

;;digit3;;
[object]
States = 0.csv,1.csv,2.csv,3.csv,4.csv,5.csv,6.csv,7.csv,8.csv,9.csv
stateFunction = Abs[floor[speedometer * 3.6/100]]
position =  0.3,2,1

;;Reverser display
[object]
States = OFF.csv,ON.csv
stateFunction = ReverserNotch > 0
[object]
States = OFF.csv,ON.csv
stateFunction = ReverserNotch < 0
« Last Edit: February 14, 2015, 09:32:04 pm by Manuel18 »
It doesn't matter who did it , if how he did it.
Myself :P