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"

How to make a character perform a 180° ?

Hello there :)

I have a character BP (not controlled by a player). This actor always move forward (every tick move along the forward vector). I want this actor to perform a 180° everytime he hit something (via hit event). My first thought was to use "add controller yaw input", but for some reason it does not apply to my actor. Then I tried with "set world rotation", but it seems to turn my mesh but not the forward vector. I also tried with "set control rotation" but I have some weird results.

How would you guys manage to do that ?

Thanks in advance

Product Version: Not Selected
Tags:
more ▼

asked May 25 '14 at 10:06 PM in Blueprint Scripting

avatar image

vychnou
1 1 3 3

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

2 answers: sort voted first

Set Actor Rotation?

It really depends on how the movement is applied. You may need to rotatte the character AND reverse the movement.

more ▼

answered May 26 '14 at 12:20 AM

avatar image

Zeustiak
1.8k 130 68 110

avatar image vychnou May 26 '14 at 08:56 AM

Thanks for your answer. I'll try "Set actor rotation" as soon as I get home.

For your second sentence, how would you reverse the movement ?

avatar image Zeustiak May 26 '14 at 09:03 AM

Whatever gives the actor its original movement can surely be copied and reversed. Depends on what you are working on of course.

avatar image vychnou May 26 '14 at 10:08 AM

I compute the new location every tick with the actor's forward vector. My understanding was that whenever you rotate the actor, you also rotate it's forward vector, isn't it ?

avatar image Zeustiak May 26 '14 at 10:11 AM

True, but you said the mesh rotated but not the movement. But that probably has to do with World Rotation somehow. Set Actor Rotation should give you a new forward direction I would think.

avatar image vychnou May 28 '14 at 01:30 PM

Thanks, it works way better with "Set actor rotation"

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

This should do what you want it to do. Moves continuously in one direction until it encounters something, then rotates 180 degrees and moves in that direction. I set it up for begin overlap events, but hits will work just as well if you've got collisions set up right.

alt text

untitled.jpg (115.4 kB)
more ▼

answered May 26 '14 at 01:52 PM

avatar image

Bohrium
298 21 16 43

avatar image vychnou May 26 '14 at 02:42 PM

Wow thanks, It looks close to my own blueprint except I was using Set World Rotation instead of Set Actor Rotation. Not sure I understood the difference between the two functions. If you can bother explain me ?

avatar image Bohrium May 26 '14 at 03:06 PM

The target of a set world rotation is SceneComponent rather than Actor, so it will be a mesh or capsule or whatever within your actor, rather than the actor itself. So if you get a reference to self and try to attach that to a set world rotation, it will ask if you want to go through a conversion and then pick a component from your actor on it's own.

avatar image vychnou May 28 '14 at 01:30 PM

Thanks, it works way better with "Set actor rotation"

(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