Download

Vinterpto only working when moving o.0

Soo the following code has an issue its called from a function and it will only work if you are moving but once u stop it stops working all together. its just a simple recoil code bit that just move the arms back a tiny bit. i even tried this in world space with same results. is there something wrong with this line of code for it to not be called every time the function is called?


 

  1. FVector* tempVector = new FVector(0,0,0);
  1. tempVector->X = ArmsBasePostion.X + Recoil;
  1. FPSArms->RelativeLocation = FMath::VInterpTo(ArmsBasePostion, FVector(tempVector->X, ArmsBasePostion.Y, ArmsBasePostion.Z), GetWorld()->DeltaTimeSeconds, 5);

 

Yeah i fixed this …

Pretty rare that you should ever need to use new and delete operators in UE4. What’s wrong with:



FVector TempVector = FVector::ZeroVector;
TempVector.X = ArmsBasePosition.X + Recoil;


was a old habit from unity c#. think nothing of it :stuck_out_tongue:

Unity goes like…

Ahhh fair enough! Just be careful, ‘new’ works very differently in C++!