ATableLogPos_UnrealPawn::ATableLogPos_UnrealPawn()
: CurrentDrawingHeave(0)
, CurrentDrawingPitch(0)
, CurrentDrawingRoll(0)
{
// ... generated UE4 code removed for better clarity
// ForceSeatMI - BEGIN
memset(&PlatformPosition, 0, sizeof(PlatformPosition));
PlatformPosition.structSize = sizeof(PlatformPosition);
// The demo program is able to provide pause, position and speed limit
PlatformPosition.maxSpeed = PLATFORM_MAX_SPEED;
PlatformPosition.mask = FSMI_POS_BIT_STATE | FSMI_POS_BIT_POSITION | FSMI_POS_BIT_MAX_SPEED;
// ForceSeatMI - END
}
void ATableLogPos_UnrealPawn::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
// ... generated UE4 code removed for better clarity
// ForceSeatMI - BEGIN
SendCoordinatesToPlatform();
// ForceSeatMI - END
}
void ATableLogPos_UnrealPawn::BeginPlay()
{
Super::BeginPlay();
// ForceSeatMI - BEGIN
if (FSMI_True == IForceSeatMI::Get().GetAPI().BeginMotionControl())
{
SendCoordinatesToPlatform();
}
// ForceSeatMI - END
// ... generated UE4 code removed for better clarity
}
void ATableLogPos_UnrealPawn::EndPlay(const EEndPlayReason::Type EndPlayReason)
{
Super::EndPlay(EndPlayReason);
// ForceSeatMI - BEGIN
IForceSeatMI::Get().GetAPI().EndMotionControl();
// ForceSeatMI - END
}
void ATableLogPos_UnrealPawn::SendCoordinatesToPlatform()
{
// ForceSeatMI - BEGIN
PlatformPosition.state = FSMI_STATE_NO_PAUSE;
PlatformPosition.roll = static_cast(FMath::Clamp(CurrentDrawingRoll / DRAWING_ROLL_MAX * PLATFORM_POSITION_LOGIC_MAX, PLATFORM_POSITION_LOGIC_MIN, PLATFORM_POSITION_LOGIC_MAX));
PlatformPosition.pitch = static_cast(FMath::Clamp(CurrentDrawingPitch / DRAWING_PITCH_MAX * PLATFORM_POSITION_LOGIC_MAX, PLATFORM_POSITION_LOGIC_MIN, PLATFORM_POSITION_LOGIC_MAX));
PlatformPosition.heave = static_cast(FMath::Clamp(CurrentDrawingHeave / DRAWING_HEAVE_MAX * PLATFORM_POSITION_LOGIC_MAX, PLATFORM_POSITION_LOGIC_MIN, PLATFORM_POSITION_LOGIC_MAX));
IForceSeatMI::Get().GetAPI().SendTopTablePosLog(&PlatformPosition);
// ForceSeatMI - END
}