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"

How can I avoid having to call the same function multiple times in order for it to work?

This is one big weird issue. Take rotation for example: say I have Roll rotated my character, and I want to reset the roll rotation to 0.

The normal way to go about it would be:

 APlayerController* pc = Controller->CastToPlayerController();
 pc->SetControlRotation(FRotator(pc->GetControlRotation().Pitch, pc->GetControlRotation().Yaw, 0.0f));

However, that won't work. The function is executed, however no rotation takes place. So I decided to try something else:

 APlayerController* pc = Controller->CastToPlayerController();
 while (pc->GetControlRotation().Roll != 0.0f){
 pc->SetControlRotation(FRotator(pc->GetControlRotation().Pitch, pc->GetControlRotation().Yaw, 0.0f));

And usually after 2-3 calls, the roll gets to be 0.

I'm using the code in the Tick method. I'm obviously not executing it every time tick gets called, but I am trying to execute it when roll !=0. In the end, I tried debugging and went through the method calls, all looks fine except the fact that the rotation only really takes place after the second, third or forth call.

Product Version: Not Selected
more ▼

asked May 14 '14 at 07:43 PM in C++ Programming

avatar image

257 18 35 150

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

1 answer: sort voted first

Based on Our Forum Discussion

"I did. Also, this happens with the MoveRight method in the fps sample. In some places it works right away, in others, I have to call it multiple times in order for the character to actually move..."

I've never heard of anything like this

When I get weird issues, I often find it best to start over, and usually I end up with better results / find out my issue

I recommend starting a new C++ project, testing just this issue, building only required framework to test this issue

and if your issue persists, at that point you could post your test project on Answerhub to get it reviewed.


more ▼

answered May 14 '14 at 08:53 PM

avatar image

10.6k 446 346 1088

(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