MovingProcedure

From TrainzOnline
Jump to: navigation, search

Contents

Moving procedure for a container from one stack to another

This version uses meshes from a list of possible (prepared) containers. There are no queues or industrial parts, only asset instances and their meshes.

This process knows the necessary GOIDs and the necessary config container names.

The steps to go

If the container to move is not the top container, break the task with error report

The error returned should lead into tasks to shift the disturbing containers to other stacks.

If the destination stack's top isn't free, break the task with error report

The error returned should lead into tasks to shift the disturbing container to other stacks or to change the destination or to cancel the task.

Move the crane parts to the container stack's top container to move

This movement is visualized by animations of the carne's parented parts bridge, trolley, lift, rotor, gear and hooked meshes (GOID of the container stack is known).

Hook the container to the gear

Get the texture id of the container to move (GOID and fitting soups of the container are known).

Set the texture of the fitting invisible mesh of the gear to the fitting texture.

Make the fitting mesh visible (Mesh config container name is known).

Make the top container's mesh invisible (GOID and config mesh name is known). Move the invisible top container to the destination stack's top (The GOID is known).

Move the crane parts to the container's destination stack's top free position

This movement is visualized by animations of the carne's parented parts bridge, trolley, lift, rotor, gear and hooked meshes (GOID of the container stack is known).

Dehook the container from the gear

Make the top container's mesh visible (GOID and config mesh name is known).

Make the fitting crane's mesh invisible (config container mesh name is known).

Calculating the frames the animation should move to

To calculate the destination frames we need the distance vector from the crane's frame zero location to the top of the container position at the stack. Since the location is used as WorldCoordinate and the stack and crane may reside in different baseboards, the first step is to "normalize" the baseboards. In the following this is agreed.

The crane's frame zero location is defined by the reacharea inset and will be calculated by containerStackTopWC minus craneOriginWC. The containerStackTopWC will be calculated by stackOriginWC plus stackPositionHeight. The stackPositionHeight is the sum of all stacked container's heights.

As moving speed in x, y, z direction of the crane parts we will use 5.4 km/h (~3.35 mi/s). Thus deltaFrameCount/1500 calculates the duration of the movement in seconds.

Now we are able to get the current frames list, the fromStack's frame list and the destStack's frame list to move the crane.

Personal tools