Can you offset docking ?

I'm trying to dock with offset : i.e I would like to dock my train with the locomotive in the middle of the station instead of the head train station. There is an offset parameter when calling dock but it doesn't seem to be effective. Here is some code :
SUBSCRIBE_METHOD(AFGTrain::OnDriverEntered, [this](auto& scope, AFGTrain* self) {
UE_LOG(LogTrainUnloadingOffsetModule, Verbose, TEXT("[TUO] Entered train."));
this->targetTrain = self;

AFGRailroadSubsystem* RailroadSubsystem = AFGRailroadSubsystem::Get(self);
TArray<AFGTrainStationIdentifier*> TrainStations;
RailroadSubsystem->GetAllTrainStations(TrainStations);

if (TrainStations.Num() != 0)
this->targetStation = TrainStations[0]->GetStation();

UE_LOG(LogTrainUnloadingOffsetModule, Verbose, TEXT("[TUO] Found %i train stations."), TrainStations.Num());

if (this->targetStation != nullptr) {
this->targetStation->StartDocking(self->GetMultipleUnitMaster(), 1);
}
});
SUBSCRIBE_METHOD(AFGTrain::OnDriverEntered, [this](auto& scope, AFGTrain* self) {
UE_LOG(LogTrainUnloadingOffsetModule, Verbose, TEXT("[TUO] Entered train."));
this->targetTrain = self;

AFGRailroadSubsystem* RailroadSubsystem = AFGRailroadSubsystem::Get(self);
TArray<AFGTrainStationIdentifier*> TrainStations;
RailroadSubsystem->GetAllTrainStations(TrainStations);

if (TrainStations.Num() != 0)
this->targetStation = TrainStations[0]->GetStation();

UE_LOG(LogTrainUnloadingOffsetModule, Verbose, TEXT("[TUO] Found %i train stations."), TrainStations.Num());

if (this->targetStation != nullptr) {
this->targetStation->StartDocking(self->GetMultipleUnitMaster(), 1);
}
});
I have a train at the first freight platform (counting from the head station) I want to dock it when I enter it, I get the first station in the world (there is just one) and call StartDocking with offset set to 1. What happens : the dock starts but there is 0 offseting, the animation play (meaning that the first freight platform container clips through the locomotive), the freight cart are then filled as if I docked at the head station. I've attached a few screenshots. I suspect the the offset parameter is not used at all. Does anyone is familiar with these ?
No description
No description
No description
No description
1 Reply
Robb
Robb3w ago
unrelated to your question, but since LogTrainUnloadingOffsetModule is a log category, you shouldn't need the [TUO] string in all of your messages if you're trying to filter to just your messages

Did you find this page helpful?