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"

Bending Tall Grass

I want to rotate a static mesh away from the player character to simulate trampling of tall grass.

To make the grass "lie down" away from the player would be relatively easy by just facing the player with the Z-axis and then lie it down 90 degrees in X or Y, but that would make the grass turn, which would be really weird.

So I'd need to calculate the rotation only in X and Y, and my math skills are not quite up to the challenge. Any math wiz who might be able to point me in the right direction would be greatly appreciated.

Product Version: UE 4.19
Tags:
more ▼

asked Aug 09 '18 at 05:30 AM in Blueprint Scripting

avatar image

Raptorcore
56 2 7 6

avatar image Raptorcore Aug 09 '18 at 03:34 PM

I calculated a simple but most likely very redundant manual solution using LookAtRotation and then manually setting the X and Y rotation depending on whether LookAtRotation's Yaw is between 0 and 90, -90 and 0, -180 and -90 or 90 and 180. This results in four big conditional checks each for X and Y, and I'm sure there is some vectormath that could calculate both in a much more efficient way. At least it works as intended for now, but I'd appreciate learning a more proper way of doing it.

This is the result; four bushes lying down away from the ball after rolling over them from different directions.

Preview

This is the chunky manual calculation of just the Y rotation.

alt text

bend01.png (81.0 kB)
bend02.png (247.4 kB)
(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
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