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 do I set up rigid body rotation towards a target vector?

Hi,

I am planning to make a space ship that controlled by the mouse similar to a strategy game where you click somewhere and the actor is trying to get there. To get a more or less realistic look I want to use rigid body physics to make the ship rotate nicely towards the target direction. Before I do all the work by myself I was searching the source for something similar that is already part of the engine and can be used for my purpose. The source however is huge and I might have overlooked something. Therefore I want to ask here if there is a feature somewhere that could be useful in this case. Maybe something related to the AI pathfinding.

I would be grateful for any helpful comments.

Product Version: Not Selected
Tags:
more ▼

asked May 14 '14 at 08:55 AM in Using UE4

avatar image

Praseodyl
247 15 15 135

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

1 answer: sort voted first

Hey Praseodyl,

Take a look at the Top Down templates, whether in Blueprints or Code. The project uses a Nav Mesh and click-to-move controls, with a smooth turn transition for the character, which sounds like exactly what you're looking for.

Hope that helps!

Ben Halliday

more ▼

answered May 14 '14 at 05:51 PM

avatar image Praseodyl May 15 '14 at 05:29 PM

Thank you for the helpful comment.

I had however a few problems when I was playing arround with that feature: It looks like the movement direction is not connected to the orientation of the character. I tried to lower the rotation speed of the character to get something that might be mistaken for a space ship changing its course and ended up with a character who moved to the target point in a straight line while still 'looking' in the original direction. Another problem was the missing momentum. As soon as I 'told' the character to turn in the opposite direction the character starts turning in that direction, ignoring its angular momentum in the previous direction. Another closely related point is that the character seems to turn at a constant rate. To get a somewhat realistic effect I would need an accelerated movement.

Is there a way to switch on those features or do I have to play arround with the 'AddTorque' function.

avatar image Ben Halliday STAFF May 15 '14 at 09:08 PM

Yea, it sounds like you're going to need to go a lot deeper into your Blueprint to get what you're looking for. The Top Down template is a good reference point, but the Simple Move to Location node in the Move to Hit Location graph isn't an editable function and is based on the Nav Mesh system.

Take a look on AnswerHub and the forums for what other users have built so far. Here's a couple links that might help get you started:

It is certainly possible to build what you're looking for, though, if you're willing to experiment some. I hope some of this helps!

Ben Halliday

(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