Pricipitation box not orienting itself with train.

Bug #1546191 reported by Edward Keenan
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Open Rails
New
Undecided
Unassigned

Bug Description

If the train starts off following a path within the precipitation box in a relatively straight line, everything is fine. But, if the path within the box happens to make an extreme change of direction within the box, the precipitation box fails to adjust to this. So, what starts off with plenty of precipitation such as snow down the track, turns into a situation where the train is chasing the edge.

This is noticeable if you run Scenic Sub 1 activity, "ACT 3 Eastbound Stack". The activity starts off fine with snow being properly displayed ahead of the train since it is following a straight line, but once the train takes the line that heads east, the line nearly turns the train around in the Precipitation box, the snow ahead of the train starts to thin out and the edge of the box can be seen.

I am currently attempting to understand the issue to fix this, but if someone else who has a better understanding of coordinates can solve this, then go for it.

Edward K.

Revision history for this message
James Ross (twpol) wrote :

I've not double-checked, but from memory the intended behaviour is that the precipitation box follows the *target* of the camera around. If it is oriented at all, it should be based on the camera. It may well not be oriented as, the box used to be the same X and Z size IIRC.

Revision history for this message
Edward Keenan (edwardk) wrote :

James,

It is connected with the camera.

var worldLocation = viewer.Camera.CameraWorldLocation;

And I believe this is the key calculation which is called from the Update() process. The above is also part of the Update() process.

var temp = new WorldLocation(worldLocation.TileX, worldLocation.TileZ, worldLocation.Location.X + (float)((Viewer.Random.NextDouble() - 0.3) * ParticleBoxLengthM), 0, worldLocation.Location.Z + (float)((Viewer.Random.NextDouble() - 0.3) * ParticleBoxWidthM));

Revision history for this message
Edward Keenan (edwardk) wrote :

The screenshot will show this. If you proceed in a straight line out from the locomotive, you will notice that the snow fall is normal, but once you follow the line to the right, the precipitation starts to thin out. You can't tell from this screenshot, but once you proceed further down the line, you will notice the edge.

Revision history for this message
Edward Keenan (edwardk) wrote :

Here is another screenshot showing the side view once further down the line. The precipitation you see ahead should actually be ahead of the locomotive since the length of the box used here is 2,525 meters.

Revision history for this message
Edward Keenan (edwardk) wrote :

Working with the code below which is the original from the code, I was able to make minor adjustments in the overall position by changing 0.5 for the worldLocation.Location.Z calculation to 0.55. Moving the box to the left seems to have helped, but would this be temporary. Would there be a better way of keeping the box centered over the train? I am currently experimenting with using the player train as the source of the location instead of the camera.

var temp = new WorldLocation(worldLocation.TileX, worldLocation.TileZ, worldLocation.Location.X + (float)((Viewer.Random.NextDouble() - 0.5) * ParticleBoxLengthM), 0, worldLocation.Location.Z + (float)((Viewer.Random.NextDouble() - 0.5) * ParticleBoxWidthM));

Revision history for this message
Edward Keenan (edwardk) wrote :

Edit: Using 0.55 moves the box to the right, not the left.

Revision history for this message
Edward Keenan (edwardk) wrote :

I believe I may have found the solution which I am testing and so far it is working. The use of the Normalize() function. Since this is used to make sure tile coordinates are within tile boundaries, its possible that the current calculations are not accurate since this is not being done in the Update() process. Once temp is created as a WorldLocation, I run it through Normalize(). The adjustment that I made above is now back to 0.5 and up to this point, current tests are looking good. Just one more final test to check to see if this is the case.

Revision history for this message
Edward Keenan (edwardk) wrote :

Its possible the Normalize() process may be helping, but the end result is still a fail. Adjusting the box manually to the left or right is not feasible since the train could very well be traveling to the left versus the right in the route I am testing.

Revision history for this message
Edward Keenan (edwardk) wrote :

I am running out of options to try. Evidently it must have something to do with the fact its not a straight line. The path that the train follows nearly turns around so it appears that the current process is unable to handle curves. Let me know if you do come with something to try.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.