Page 1 of 1

objects visible/invisible based on unit/coach number

PostPosted: Sun Jul 10, 2022 6:23 pm
by DanEvans
A question about setvars here:
I'm developing the SR-designed Class 415/1 4-EPB to go with DTG's existing BR designed 415/6 units and I am aiming to reproduce the replacement doors found seemingly at random on these earlier units. These doors differ from the original by having no toplight above the main droplight. I am using Blender

I have modelled the doors on each side of the coach in both original and replacement form, with differentiating object names, so each carriage would be exported with two sets of doors with and without toplights.

Is it possible, through scripting to make certain doors visible or invisible depending on the unit or carriage number to give the impression that the train has had some of its doors replacement ad hoc?

Re: objects visible/invisible based on unit/coach number

PostPosted: Sun Jul 10, 2022 10:12 pm
by AndiS
Basically, it is easy. For the main shape, i.e., the IGS file, that is the main body, you say
Code: Select all
Call ("ActivateNode", "door1", 0 )

to make the part of the model that is named 1_2000_door1 in Blender invisible. (1 and 2000 are just examples, it is the same for whatever LOD thresholds you use.)

So your body will consist of one object in Blender that is named x_XXXX_door1 and that shows one variant and x_XXXX_door2 that is the alternate version of the doors, all in the same place. They share the object origin with the rest of the body model.

Then in your script, you decide whether to hide door1 or door2. You can do that at random or use a dummy digit (character) in the vehicle number to decide the door. you get the vehicle number calling
Code: Select all
Call ( "GetRVNumber")


However, there could be an issue with opening doors. I have no experience on that, not doing any vehicles. I seem to remember you must name them door or so and same for a few other parts. That seems to work against the idea sketched above.

However if, in Blender, you make the alternate door parts child objects of the main door, then you can call the unchanged door parts door so they are seen as doors by the game editor and your alternate parts could be mydoor1a and mydoor1b, parented to door1 in Blender, thus moving about in unison with it.