Geschrieben 28. Mai28. Mai I wish a method to exchange the speeds of 2 vehicle at collision and then disconnect them. Is there a solution for this and what kind of property settings needed for?
Geschrieben 28. Mai28. Mai There is no collision detection event, @Leslie. We have no means to respond to a collision. Actually, there are no collisions as such. With active couplers, vehicles slow on approach and stop when they couple. With inactive couplers, the stop short and avoid collision (when automatic breaking is active, as it should be.)
Geschrieben 29. Mai29. Mai Autor I know, not such event. I must get state other way. But the question is the method of speed excange. If 2 vehicles is moving each other and first has less targetspeed than last. This is real case. I have tried but failed. Have anybody a solution?
Geschrieben 29. Mai29. Mai Hallo / hello @Leslie, aktiviere die beiden markierten Buttons im Eigenschaftsfester des Fahrzeugs, um die Geschwindigkeits-Anpassung an das vorausfahrende Fahrzeug zu aktivieren. Activate the two highlighted buttons in the vehicle's properties window to activate the speed adjustment to the vehicle in front. Viele Grüße / many greetings BahnLand
Geschrieben 29. Mai29. Mai Autor I am far away from this. Current routine: if vehicle.couplers[1] ~= nil then local v = vehicle.couplers[1].vehicle.targetSpeedAbs vehicle.couplers[1].vehicle.targetSpeedAbs = vehicle.targetSpeedAbs vehicle.targetSpeedAbs = v end Piti, still does not work. I hoped somebody can help otherwise this shall be a long debugging.
Geschrieben 29. Mai29. Mai vor 15 Minuten schrieb Leslie: local v = vehicle.couplers[1].vehicle.targetSpeedAbs Why would you assume that the coupler has a speed? The vehicle does! local v = vehicle.targetSpeedAbs The vehicle has a coupler, which you may check as a condition (as you do) And the vehicle has a speed (which you may read and store in a local variable)
Geschrieben 29. Mai29. Mai Autor Not speed of coupler. Vehicle has coupler: vehicle.couplers [1] Coupler connects to another vehicle: ...couplers [1] .vehicle This vehicle has speed: ...vehicle.targetSpeedAbs
Geschrieben 29. Mai29. Mai vor 4 Minuten schrieb Leslie: Coupler connects to another vehicle: ...couplers [1] .vehicle my apologies, Leslie
Geschrieben 29. Mai29. Mai vor 2 Minuten schrieb Leslie: Coupler connects to another vehicle: ...couplers [1] .vehicle but this is evidently the same vehicle vor 32 Minuten schrieb Leslie: local v = vehicle.couplers[1].vehicle.targetSpeedAbs
Geschrieben 29. Mai29. Mai vor 9 Minuten schrieb Phrontistes: but this is evidently the same vehicle no, it's not (I made the same mistake) The property couplers[1].vehicle is not identical with the object vehicle Es ist doch dasselbe Fahrzeug. Sorry! "enthält eine Referenz zu dem Fahrzeug, zu dem die Kupplung gehört" (nicht, wie ich flüchtig interpretiert hatte, dem Fahrzeug, das an der Kupplung hängt) Bearbeitet 29. Mai29. Mai von Goetz
Geschrieben 29. Mai29. Mai I found a mistake, @Leslie The condition is incomplete! It should be if vehicle.couplers[1].enabled == true then and as @Phrontistes rightly pointed out: couplers[1].vehicle references the vehicle which owns the coupler, not the vehicle connected at the coupler Bearbeitet 29. Mai29. Mai von Goetz
Geschrieben 29. Mai29. Mai Since you still don't have the connected vehicle, you will surely discover .connectedCoupler at some point. Bearbeitet 29. Mai29. Mai von Phrontistes
Geschrieben 29. Mai29. Mai Hi, vor 19 Stunden schrieb Goetz: There is no collision detection event, vor 10 Stunden schrieb Leslie: I know, not such event. How do you want to detect that a collision has taken place? EASY Bearbeitet 29. Mai29. Mai von EASY
Geschrieben 29. Mai29. Mai Autor Collision detection at any other event, eg. enter track. When vehicles connected then collison occured. This case one pulls another. The problem is: I do not want to connect them! So couplers disabled. But they are also connected: eg. one pulls another among turnouts like connected vehicles. Check this if you want. Also they not connected in level of program because couplers are nil. I wish to exchange speeds then auto disconnect. This rutine: if vehicle.couplers[1].connectedCoupler ~= nil then local v = vehicle.couplers[1].connectedCoupler.vehicle.targetSpeedAbs vehicle.couplers[1].connectedCoupler.vehicle.targetSpeedAbs = vehicle.targetSpeedAbs vehicle.targetSpeedAbs = v end seems work some time.
Geschrieben 29. Mai29. Mai Autor Oher problem: if $("camera").link is vehicle then command $("Camera").link.autoDeceleration = true causes error property autoDeceleration does not exist. How to set autoDeceleration in LUA on linked vehicles?
Geschrieben 29. Mai29. Mai vor 34 Minuten schrieb Leslie: $("Camera").link.autoDeceleration = true works just fine when I try it. You may want to verify that the camera is linked to the vehicle (chain icon in top menu bar) And check the name too. Upper case and lower case are not arbitrary Bearbeitet 29. Mai29. Mai von Goetz picture added
Geschrieben 29. Mai29. Mai vor einer Stunde schrieb Leslie: vehicle.couplers[1].connectedCoupler.vehicle.targetSpeedAbs = vehicle.targetSpeedAbs is valid only if vehicle.couplers[1].connectedCoupler.vehicle has an engine and engine is started. vor einer Stunde schrieb Leslie: local v = vehicle.couplers[1].connectedCoupler.vehicle.targetSpeedAbs ... vehicle.targetSpeedAbs = v What are these two lines for?
Geschrieben 29. Mai29. Mai Autor "camera is linked to the vehicle" Yes, it is automatic, not hand-made. But some cases camera connected to a switch which has no engine, totally no acceleration. So I modified condition to check this switch, this works.
Geschrieben 29. Mai29. Mai Autor What are these two lines for? Exchange speeds thru local v. I tried advice of Bahnland, all cars got smooth decceleration. This solves collision but causes other problem: vehicles must enter to turnouts to automatic change. At smooth decceleration sometimes lines too short, vehicle stops before reach turnout and hangs up. Is there a method to avoid car collision and also drive to end of roads?
Geschrieben 29. Mai29. Mai vor 35 Minuten schrieb Leslie: But some cases camera connected to a switch which has no engine, totally no acceleration. Automatic deceleration / acceleration only works with a vehicle which has an startet engine. vor 31 Minuten schrieb Leslie: there a method to avoid car collision and also drive to end of roads? You have to try out the appropriate acceleration / deceleration in m/s².
Geschrieben 29. Mai29. Mai vor 39 Minuten schrieb Leslie: Exchange speeds thru local v. Okay, but I don't understand the whole thing anyway: coupled vehicles cannot have different speeds.
Geschrieben 29. Mai29. Mai Autor "coupled vehicles" Who says this? All my force I struggle for not to connect them! They are all individuals with different speeds! This may cause collision! But here is the solution: vehicle plays smooth usually. This avoids collision at long roads. But if stops, it changes to hard way which allows manoeuvres may switch turnouts to solve the problem.
Geschrieben 29. Mai29. Mai Hi, vor 24 Minuten schrieb Leslie: "coupled vehicles" Who says this? ... why this???? vor 3 Stunden schrieb Leslie: if vehicle.couplers[1].connectedCoupler ~= nil then ... vehicle.couplers[1].connectedCoupler is always nil when vehicles not coupled! EASY
Geschrieben 29. Mai29. Mai Autor This is true. But how to re-place not connected vehicles to other road on changed turnouts? This usually happens only at connected vehicles.
Geschrieben 29. Mai29. Mai vor 3 Minuten schrieb Leslie: turnouts ... connected vehicles Cars may come very close to each other at turnouts. But they don't couple (because their couplers are not active by default) So even when two cars look like they are connected, the condition will still say "nil"
Erstelle ein Benutzerkonto oder melde dich an, um zu kommentieren