Hi all, So i’m trying to do something rather simple, move my Actor ( bucket ) along the X axis whilst having the x axis clamped between the values -90.f and 90.f.
So here is my code…
XMovement = GetInputAxisValue("MoveHorizontal") * 20.f * DeltaTime;
Bucket->AddLocalOffset(FVector(XMovement, 0.f, 0.f));
FMath::Clamp<float>(Bucket->GetComponentLocation().X, -90.f, 90.f);
I’ve tried different variations of it, for example updating the x axis to equal a variable and then clamping that. however this was quite obviously a fail.
So can someone please tell me why im being an idiot and cant figure this out ?
Thank you !!!