I would like to have the actor’s static mesh component and UBoxComponent (or collider) to have an offset from the actor’s location in the Tick(DeltaSeconds) after finishing the OnConstruction(Transform) function call. My goal is to have static mesh components and collider components be placed at an offset when a player is pressing down a key, and then return to its original position when the player releases a key.
// Called to bind functionality to input
void ABaseFrame::SetupPlayerInputComponent(class UInputComponent* InputComponent)
{
Super::SetupPlayerInputComponent(InputComponent);
InputComponent->BindAxis("Swivel", this, &ABaseFrame::Swivel);
}
void ABaseFrame::Swivel(float Value){
if ((this->Controller != nullptr) && (Value != 0.0f)){
LOG("Doing something.");
for (auto Iterator = this->AngleFrameArray.CreateIterator(); Iterator; ++Iterator){
AAngleFrame* AngleFrame = *Iterator;
AngleFrame->SetActorRelativeLocation(FVector(0.0f, 0.0f, 120.0f));
}
}
else {
LOG("Not Doing something.");
for (auto Iterator = this->AngleFrameArray.CreateIterator(); Iterator; ++Iterator){
AAngleFrame* AngleFrame = *Iterator;
AngleFrame->SetActorRelativeLocation(FVector(0.0f, 0.0f, 0.0f));
}
}
}
I thought you could do this, but it doesn’t seem to make any significant difference in temporarily moving the component’s location around.
What do I need to do?