# How to make a Scoring System for a Range Target?

This is the Target picture. Can anyone help me, How do we make a scoring system for such kind of target, if any on the two values are hit, it should take the greater value, conditional scoring?

Every help is appreciated.

how are you handling shooting?

you could use overlap events with projectiles, or distance from center with traces, or im sure theres ways with materials, and many more. but first we need to know how your handling the shooting aspect as that determines which options are viable.

When the shot is hit to the target using a scope sighted rifle in TPS, the score counter should count the number where the shot is hit, I have tried a distance from the center with traces but didnâ€™t work as accurate for me, I am finding some accurate solution, How do we do it with Materials to overlap events, like mesh colliders?

Best way would be to measure the distance to the center of the target. You could set a bunch of thresholds manually, but if the distances are constant, just use some math

How do we do that?
Can you give me references or Guide me through it?
The distances are constant.

You take the hit location (or impact location, or bullet location), and get the distance to the center of the target (Ideally flat on the targetâ€™s normal axis).

If the distance from the center to the border of the board is 100. a hit with distance between 0 and 5 could be max score. while a distance between 95 and 100 would be the lowest score.

So basically you can break down the problem:

1. where was the hit on the board. (vector)

2. where is the center of the board. (vector)

3. whatâ€™s the distance between those. (float)

4. convert the raw distance into a neat score value. (integer)

Hello Evigmae
Can you share me any reference video? that might help me to understand that.

How do we know the distance from the center to the border exactly?
What are the units we use for vector? how do we use vectors?

Check this Image, This is what I have right now, but I am not understanding how to use the vectors

Any help is appreciated!

Hey Harsh Bakshi!
Your image looks like itâ€™s on the right track to accomplish Evigmaeâ€™s solution, but we canâ€™t tell what youâ€™re plugging into the vector subtraction (which makes it hard to diagnose whatâ€™s going on).
Iâ€™d probably set up the target actor like this:

All Iâ€™ve done is attached a scene component to the center of the target (â€śBullseyeâ€ť) and another to the edge of the target (â€śEdgeâ€ť).

For the OnComponentHit event for the target, you can take the difference between the projectileâ€™s impact point (the â€śLocationâ€ť part of the HitResult) and the world location of the â€śBullseyeâ€ť scene component. That vector length will be the distance from the targetâ€™s center.

The image above also shows a little bit of Blueprint code showing that you can get the targetâ€™s radius by getting the distance between the Edge component and the Bullseye component. This might be useful to know if you want your targets to be different sizes.

The units for vectors depend on what youâ€™re doing with them. GetWorldLocation and the Location pin of the HitResult are in Unreal Units (uu), so the vector you get when you subtract them will also be in uu. Vectors are pretty flexible though - you could, for instance, use them to store the RGBA values of a color (which will not have units in uu).

Hope that helps!
Bryant

1 Like

Thanks Helped!