Source/xsite_ue/FlystickDraggableActor.cpp
// Called when the game starts or when spawned

Called when the game starts or when spawned
Called when the game starts or when spawned
void AFlystickDraggableActor::BeginPlay()
{
    Super::BeginPlay();
    if (GetWorld()->IsServer())
    {
        auto *PlayerController = UGameplayStatics::GetPlayerController(GetWorld(), 0);
        this->EnableInput(PlayerController);
        if (IsValid(this->Mesh))
        {
            this->Mesh->SetSimulatePhysics(true);
            this->Mesh->SetEnableGravity(true);
        }
    }
    else
    {
        if (IsValid(this->Mesh))
        {
            this->Mesh->SetSimulatePhysics(false);
            this->Mesh->SetEnableGravity(false);
            this->Mesh->SetCollisionEnabled(ECollisionEnabled::Type::NoCollision);
            this->Mesh->PutRigidBodyToSleep();
        }
    }
}
void AFlystickDraggableActor :: BeginPlay ( ) { Super :: BeginPlay ( ) ; if ( GetWorld ( ) -> IsServer ( ) ) { auto * PlayerController = UGameplayStatics :: GetPlayerController ( GetWorld ( ) , 0 ) ; this -> EnableInput ( PlayerController ) ; if ( IsValid ( this -> Mesh ) ) { this -> Mesh -> SetSimulatePhysics ( true ) ; this -> Mesh -> SetEnableGravity ( true ) ; } } else { if ( IsValid ( this -> Mesh ) ) { this -> Mesh -> SetSimulatePhysics ( false ) ; this -> Mesh -> SetEnableGravity ( false ) ; this -> Mesh -> SetCollisionEnabled ( ECollisionEnabled :: Type :: NoCollision ) ; this -> Mesh -> PutRigidBodyToSleep ( ) ; } } }
Called when the game starts or when spawned
Called when the game starts or when spawned
// clients mesh gets updated by replicated server data
