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 find the angle of incidence of a projectile hit

I am currently using a physical projectile system and I want to only ricochet (bounce) projectiles when the angle between the surface normal and the projectile vector is above a certain value. Example: alt text

I've looked through several answers on how to achieve this but none of them seem to give me expected results.

Based on this answer, here is what my BP graph currently looks like for calculating the angle of incidence:

alt text

However this is giving me unexpected results. When at a more glancing angle, I seem to get a believable angle value (111 degrees) as seen from this image:

alt text

However when I am more head on with the object, the angle gets larger!

alt text

I know that the correct answer to this question is for me to get better at vector math, however hopefully someone can point me in the right direction so that I can achieve what I am looking for here.


Product Version: UE 4.12
more ▼

asked Jun 20 '16 at 05:16 PM in Blueprint Scripting

avatar image

1 3 3 5

avatar image MacroPolo Jun 20 '16 at 07:12 PM

I believe I have fixed this by subtracting the arccos angle from 180.

avatar image Stevadore Aug 06 '16 at 07:45 PM

Thank you. I've been trying to figure out how to do this for a while. I've added to it for my own needs so I can get a chance out of 100 that the bullet will ricochet. The greater the angle the better the chance it will ricochet.

alt text

getangle.png (3.4 MB)
avatar image 0vr Nov 26 '17 at 03:30 AM

With this I'm getting a range from 0 (straight on) to 90 on both sides. How do I know if i'm hitting it from the left or the right? If I'm coming from the left side of the object or the right side of the object to hit in the same spot

(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