Oooh! Look wot I done!!

View previous topic View next topic Go down

Oooh! Look wot I done!!

Post by graymac on Sat Sep 24, 2011 4:09 pm

While we're on the animated theme, for the routebuilders let's take a look at level crossings. I recently spent a fair few hours making a crossing with lifting barriers and alternating flashing lights. You can find the basic code from the example in the Demo Route on OBVE, which I carved up and helped myself to bits of it.

I have a (not yet released) branch line with a lot of manual gated crossings. Obviously opening gates woud be a gas. I think I have a working solution, shown here with the wrong sort of gates. But if anyone wants to have a go here's the code for the animated file and the barrier mesh (modify it and make yer own bitmap)

Used here, a simple barrier (made for a lifting barrier but it will do to demonstrate with)

[MeshBuilder]
vertex 0.1,0.125,0
vertex 0.1,0.08,3.4
vertex 0.1,-0.125,0
vertex 0.1,-0.08,3.4
vertex 0,-0.125,0
vertex 0,-0.08,3.4
vertex 0,0.125,0
vertex 0,0.08,3.4
face 0,1,3,2
face 2,3,5,4
face 4,5,7,6
face 6,7,1,0
[texture]
load barr_stripe.png
coordinates 0,0,0
coordinates 1,4,0
coordinates 2,0,1
coordinates 3,4,1
coordinates 4,0,2
coordinates 5,4,2
coordinates 6,0,3
coordinates 7,4,3

** barr_stripe.png is a 32x16pix bitmap, white fill left, red fill right


;;The .ANIMATED file
;;[include]
;;filename This would be the .b3d/.csv file for the static scenery parts,
;;you can include as many as you need with their own include

;;the far left gate
[Object]
Position = -3.6, 0, 7
States = crossing_gate.b3d
RotateYFunction = (abs[trackdistance] > 200) * (-1.4)+3.14215
RotateYDamping = 1, 2

;;the far right gate
[Object]
Position = 3.6, 0, 7
States = crossing_gate.b3d
RotateYFunction = (abs[trackdistance] > 200) * (1.4)-3.14215
RotateYDamping = 1, 2

;;the near left gate
[Object]
Position = -3.6, 0, 0
States = crossing_gate.b3d
RotateYFunction = (abs[trackdistance] > 200) * (1.4)
RotateYDamping = 1, 2

;;the near right gate
[Object]
Position = 3.6, 0, 0
States = crossing_gate.b3d
RotateYFunction = (abs[trackdistance] > 200) * (-1.4)
RotateYDamping = 1, 2

Adjusting the working distance

(abs[trackdistance] > 200)
The number 200 in the formula causes the gates to close the road when the train is 200metres from the crossing. It is likely a longer distance will be needed in practical use, depending on line speed. Just change the number and see if the gates open before the train gets to them!
I haven't made the finished item yet, if one of you'se beats me to it I blame myself for telling ye!!!
Attachments
swinging.JPG You don't have permission to download attachments.(30 Kb) Downloaded 13 times
avatar
graymac

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

http://www.celtictrainsim.com

Back to top Go down

Re: Oooh! Look wot I done!!

Post by Dexter on Sat Sep 24, 2011 7:52 pm

Nice, Graham. From what I have read I assume you are rotating the gates horizontally...? I am planning to provide a vertically rotating gates along with flashlight (right-left)... I might take a bit of inspiration of this, although I am not too sure how to secure a 90 degrees rotation. It is equal to 1.53 radians, but I am adjusting the condition for performing the rotation...
avatar
Dexter

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

http://www.brnobve.eu

Back to top Go down

Re: Oooh! Look wot I done!!

Post by leezer3 on Mon Sep 26, 2011 11:26 pm

Now if you want true manual gates (ala light railway & some very small stations), you could build them as a signal Smile
Build a station just before the level crossing, with the signal setting set to red. Then set your animation to trigger when the signal hits green.....

Definitely doable, not that I'm fiddling with either option at this time of night Surprised
I'm still trying to get a passing train to trigger in this way- In theory, if I'm sitting in the loop line, and the mainline is dead straight this is possible, if a pain in the neck!

Cheers

Chris Lees

http://www.bvecornwall.co.uk

leezer3

Posts : 938
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Re: Oooh! Look wot I done!!

Post by graymac on Tue Sep 27, 2011 10:03 am

Theres quite a few possibilities worth trying with the .ANIMATED file format and that's a good suggestion. I'm all for using animation for proper functionality. I'm just not bothered about gimmicks which are more often than not hardly noticeable in use. So I have opening doors on most of my trains now. But not rotating wheels or detailed interiors.
I'm releasing the new Container Dock and Ferry Port route extension in the next week or two. It includes crossings with raising barriers.
The Killavalley branch [which is finished, but I'm withholding at present], has manual gated crossings, though there is color light signalling. I will probably animate the gates. At some point I intend to add another branch with manual crossings and semaphore signalling. I think the last of it here may have gone last year, and there's still a good few manual crossings. I would need to build my own sigs, BRSemaphore sigs are visibly different, as well as Irish ones being lower quadrant.

Recently I realised the .ANIMATED file is handy to assemble a "passing train" object, just using it as a "bucket" to list and space the cars. It's so much easier plonking it on the rail with a single .freeobj instruction.
I haven't tried a moving passing train yet, though there's a scenario on the new route where there's a passing loop for the container train to sit in. Unfortunately it's on a long 2000m radius curve, so that might be a tad difficult.

Keep up the good work Chris!
avatar
graymac

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

http://www.celtictrainsim.com

Back to top Go down

Re: Oooh! Look wot I done!!

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