void ANukeBullet::Tick(float DeltaTime) { Super::Tick(DeltaTime); SetActorRelativeScale3D(FVector(timeAlive * ScaleOverTime, timeAlive * ScaleOverTime, timeAlive * ScaleOverTime)); }
// Sets default values APreprekaCPP::APreprekaCPP() { // Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it. PrimaryActorTick.bCanEverTick = true; /*Kreiramo jedan podobjekat, postavimo ga za koren, ostalo podobjektte kreiramo u editoru, jer tako treba, naravno logiku cemo zadati ovde u Tick fun. koja se poziva svaki frame*/ Koren = CreateDefaultSubobject<UStaticMeshComponent, UStaticMeshComponent>(TEXT("Koren")); RootComponent = Koren; /*Parametar animacija*/ Parametar = 0; /*Prirastaj animcacije*/ Delta = 0.05; SetActorRelativeScale3D(FVector(0.4, 0.4, 0.4)); }
// Called every frame void AItemPickupActorParent::Tick( float DeltaTime ) { Super::Tick( DeltaTime ); if (m_PulseScale) { float multi = FMath::Sin(GetWorld()->GetRealTimeSeconds() * 3) * (double)m_PulseScaleAmount; if (multi < 0) multi = multi * -1; multi += m_PulseScaleAmount * 0.5; SetActorRelativeScale3D(FVector(multi, multi, multi)); } if (m_Rotate) { float angleMultiX = FMath::Sin(GetWorld()->GetRealTimeSeconds()*m_RotateAxis.X) * 360; float angleMultiY = FMath::Sin(GetWorld()->GetRealTimeSeconds()*m_RotateAxis.Y) * 360; float angleMultiZ = FMath::Sin(GetWorld()->GetRealTimeSeconds()*m_RotateAxis.Z) * 360; SetActorRelativeRotation(FQuat::MakeFromEuler(FVector(angleMultiX, angleMultiY, angleMultiZ))); } }