Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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?

 FVector* tempVector = new FVector(0,0,0);
     tempVector->X = ArmsBasePostion.X + Recoil;
     FPSArms->RelativeLocation = FMath::VInterpTo(ArmsBasePostion, FVector(tempVector->X, ArmsBasePostion.Y, ArmsBasePostion.Z), GetWorld()->DeltaTimeSeconds, 5);
Product Version: Not Selected
more ▼

asked Feb 09 '18 at 02:04 PM in C++ Programming

avatar image

32 7 14 18

avatar image Jin_VE Feb 09 '18 at 07:52 PM

Where is this being called from?

Side note: I'm not sure why you're using a pointer to an FVector but make sure you delete it when you're done with it. IMO you really shouldn't be using 'new' there at all tho, for performance reasons.

avatar image invayne Feb 10 '18 at 08:07 AM

oo thanks yeah the "new" thing is a old habit from unity. the Vinterpto is being called from a function. which is called from a timer. which is in a function. which is set to a input delegate and is called every time i fire. the whole function runs fine except this interp. i took it out and tested it in a tick with a bool to turn it off and on, to see how it would react and got same issue only working when moving.

(comments are locked)
10|2000 characters needed characters left

2 answers: sort voted first

nah i fixed it. one of those duh moments where you for get to change your temp code to real code. i had the arm reset set to just setting the arm base instead of a interpto to reset it back which would allow for the arms to ease back to its position which gives it a natural and more realistic recoil.

more ▼

answered Feb 10 '18 at 10:14 AM

avatar image

32 7 14 18

(comments are locked)
10|2000 characters needed characters left

VInterpTo needs the first parameter to be set to the result it returns so the next time it can get closer. Are you doing that? You might be getting confused with Lerp, which takes start and end with an alpha. The interp-to functions take the current and end with the time-elapsed.

Also, you could try writing the vector to the log and see what the numbers are doing. It might give insight into the problem.

For my recoil I used a timeline to drive an offset for the hand location. I use the timeline output as the alpha of a lerp. Just throwing it out there as an alternative.

more ▼

answered Feb 10 '18 at 08:28 AM

avatar image

4.3k 31 77 40

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question