So i was following one of the UE4 guides of c++ programming, and one of the “do it yourself” part is to create a component that orbits another.
I want to rotate an component (a simple static mesh) around another component (that is also the root of the actor).
I set this in the constructor. SphereComponent is the root:
OrbitSphereVisual->SetupAttachment(SphereComponent);
OrbitSphereVisual->SetRelativeLocation(FVector(0.0f, 100.0f, 0.0f));
An this in the Event Tick:
Rotate += DeltaTime * 0.1;
if (Rotate > 360)
Rotate = 1;
OrbitSphereVisual->SetRelativeLocation(OrbitSphereVisual->GetComponentLocation().RotateAngleAxis(Rotate, FVector(0, 0, 1)));
But nothing happens as it seens. What i’m doing wrong, or what did i get wrong?
Thanks.