x

Search in
Sort by:

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"

What is the Math behind a crosshair?

I wish to know how to have a crosshair change size based off of the Fire cone for a weapon

Lets say the crosshair is a circle

Product Version: Not Selected
Tags:
more ▼

asked Nov 19 '14 at 05:52 AM in Blueprint Scripting

AlphaSierra216 gravatar image

AlphaSierra216
71 10 6 11

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

1 answer: sort voted first

You mean cross hair radius based on bullet spread?

Ie if the weapon is accurate the cross hair will be small, and if the weapon is less accurate, the cross hair will be bigger.

There is not a lot of math involved. Suppose you express bullet spread in angles. ie an accurate weapon will have an angle closer to 0 and a less accurate weapon will have something like 10 degrees.

In this situation you must first decide a base line. Lets call this L. No we will need to calculate an R whcih will be the radius of the cross hair: alt text So in the image above, a is the angle (bullet spread), L is the baseline which controls the proportion and R is the radius of cross-hair(which we need to find out). So this ends up as a pure trigonometry problem. You have the angle(and hence the tan) and the length adjustment side and you need the length of opposite side. Which trigonometric relation puts all this into play? Tan!! (opposite side by adjuscent side). So

R = tan(a) * L

Simple!

Now you can adjust L to control the proportion of cross-hair radius. Lower values of L will result in smaller cross hairs and larger values of L make the cross hair grow bigger much faster with spread.

image.jpeg (9.0 kB)
more ▼

answered Nov 19 '14 at 09:03 AM

mindfane gravatar image

mindfane ♦
2.8k 147 21 98

AlphaSierra216 gravatar image AlphaSierra216 Nov 19 '14 at 12:17 PM

Thanks very much.

Here is the result. alt text

And the UMG Widget BP. alt text

The size should be at 128X128 NOT 124 to get the proper result. alt text

howitlooks.jpg (151.5 kB)
crosshairmaths.jpg (252.3 kB)
1920and124x124.jpg (242.3 kB)
(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