x

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"

RInterpTo with UpdateBasedRotation

I'm using a custom gravitymod from pull 1773 with some of my own code thrown in. I've thrown this on top of the Shootergame example and currently I have a working 1st person shooter game with Custom gravity.

The problem I have, is that I can't get the UpdateBasedRotation camera updating clunkiness to stop. To clarify the problem: I have small planets I walk on, that update the player's gravity direction each tick. Walking to whichever direction updates the players basecomponent in my CharacterMovementComponent, which then calls the UpdateBasedRotation, which calls MyPlayerController::SetControlRotation. This keeps the character's view the same in relation to the planet as it was. However the update is quite large (a few degrees per each step on the small planets) which results in the view "jumping" those few degrees.

I modified the UpdateBasedRotation function to have a RInterpTo as such:

Controller->SetControlRotation(FMath::RInterpTo(ControllerRot, ControllerRot + ReducedRotation, GetWorld()->GetDeltaSeconds(), 0.1f));

That should work, right? Well it doesn't. The camera still jumps. Maybe I'm missing the obvious here and modifying the wrong function? I thought I tracked the "jumpiness" here, but maybe it's somewhere else? Any ideas anyone?

Product Version: UE 4.10
Tags:
more ▼

asked Jan 16 '16 at 10:36 AM in C++ Programming

avatar image

Groatse
232 16 8 25

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

2 answers: sort voted first

Would it maybe help to use a spring arm for your camera and use the lag settings to prevent popping?

https://docs.unrealengine.com/latest/INT/Gameplay/HowTo/UsingCameras/SpringArmComponents/index.html

more ▼

answered Jan 16 '16 at 07:42 PM

avatar image

Ryan Darcey
786 43 37 62

avatar image Groatse Jan 18 '16 at 03:35 PM

Well that was an easy solution!

Thanks again rcdarcey!

avatar image Ryan Darcey Jan 19 '16 at 09:54 PM

thanks! converted my comment to an answer, if you wanna check that ;)

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

Fixed by rcdarcey's suggestion:

Added a springarm component and enabled camera lag.

more ▼

answered Jan 18 '16 at 03:36 PM

avatar image

Groatse
232 16 8 25

(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