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. 

Is there a way to make a sprite face the direction in which it is traveling?

Ok, so I have some code that kinda works, but not how I originally intended... In my game I have a grappling hook that has a sprite for the hook, and I want it so that whenever you use the grappling hook you are able to see that the sprite follows the direction that the hook is following. Here is the code that is related to what I have so far: alt text

That is the original code, also here are the other pieces of code that are connected to the original code:

alt text

The return value on the make vector connects to the target spot on Find Look At Rotation

alt text

And Then 1 in Sequence is executing the SetRelativeRotation function.

Part of the problem that I run into is the fact that sometimes the sprite keeps rotating around and around, but sometimes it works somewhat as intended. I have a feeling that I might be using the wrong function or that the whole setup is wrong. Any ideas?

Product Version: UE 4.13
unrealforum.png (54.3 kB)
unrealforum2.png (67.7 kB)
unrealforum3.png (41.4 kB)
more ▼

asked Nov 04 '16 at 02:45 PM in Blueprint Scripting

avatar image

1 1 3 3

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

1 answer: sort voted first


First of all I'm wondering how the rotation is updating if you are using event beginplay once. I assume that the actor gets spawned when it's time to rotate.

The issue is with the getmouseposition, because it uses screen space instead of world space. You can try to use ConvertScreenPositionToWorldPosition node after GetMousePosition, sometimes it acts a bit weird and you need to do additional math to find the correct position.

Try that and comment what happens


more ▼

answered Nov 04 '16 at 03:05 PM

avatar image

691 28 8 50

avatar image NGelderbloom Nov 07 '16 at 01:47 PM

alt text

So this is what I have now, (I also copied and pasted get player controller and get mouse position, added the node you suggested and connected the appropriate connections so that there were no compile errors) although now it doesn't even work at all. Thoughts on why this is happening?

unrealforum5.png (165.1 kB)
avatar image NGelderbloom Nov 09 '16 at 03:40 PM

Finally! I figured out my problem MOSTLY, better than nothing. The thing that was messing me up was the fact that when I attached the return value for FindLookAtRotation to SetRelativeRotation, it was returning 3 values (roll(x), pitch(y), yaw(z)) where Yaw was the thing that would mess up the rotation for some reason. So what I did was I right clicked on both of those connected nodes and clicked Split Structure Pin. After I did that I just messed around with different combinations of connections and it would seem that using the x and y pins works the way that I want it to. I'm also executing SetRelativeRotation by using an event tick node (if you want to use event tick more that once, just use a sequence node). This isn't exactly what I need, but I'll post again if I find what I need.

alt text

unrealforum6.png (139.1 kB)
avatar image NGelderbloom Nov 16 '16 at 01:13 PM

Actually now that I think about it, I could even break the links between the two X (roll) nodes between Find Look at Rotation and SetRelativeRotation.

(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