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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Can I interpolate rotation pitch of a character in tick ?

I'm using the simple code in tick to update character rotation. Character keeps flickering and the target rotation doesn't set properly.

 FRotator ActorRotation = Character->GetActorRotation();
 FRotator LerpRotation = UKismetMathLibrary::RInterpTo(Character->GetActorRotation(), TargetRotation, DeltaTime, 30.f);
Product Version: UE 4.15
more ▼

asked Mar 31 '17 at 07:43 PM in C++ Programming

avatar image

6 2 3

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

I never used UKismetMathLibrary::RInterpTo, but it might be that it is not meant to be used every frame. I use something this instead:

     float Speed = CLAMP(DeltaTime * LerpRotationSpeed, 0, 1);
     FQuat CurrentRotation = Camera->GetRelativeTransform().GetRotation();
     FQuat NewRotation = FQuat::FastLerp(CurrentRotation, TargetRotation, Speed);

The CLAMP function is a micro I use to make sure the value doesn't go above 1 on low framerates:

 #define CLAMP(value, min, max) (value >= max ? max : value <= min ? min : value)

I hope this helps :)

more ▼

answered Mar 31 '17 at 08:15 PM

avatar image

91 1 6 8

avatar image BrunoCecconi Mar 31 '17 at 09:13 PM

This way it works better, but is still flickering. Seems unreal physics don't let me update the rotation or something like that.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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