How do i get Multisphere trace to return one object a one hit?
Alright im trying to make a simple proximity ground item inventory. Where i access through my personal inventory. IM using multisphere trace to do this. but my static gun mesh returns as more then one item. Apples are fine though.
my gun mesh
Inventory UI/Hit results
asked Jan 15 '18 at 10:20 AM in Blueprint Scripting
Multisphere traces are overkill for detecting actors in a spherical range. It's basically a line trace with a radius. It's more work for the CPU and it's not the most elegant way either so I think you'd be better off doing this differently. Here's what I do for my pickups.
What you want to do is use a collision component and the OnComponentBeginOverlap/OnComponentEndOverlap events to detect when things come within a certain range. When you get the begin overlap event, check that the actor is a type you can pick up, and then put it in an array of "NearbyItems" (use AddUnique just in case so there are no duplicates). On end overlap you want to remove the actor from the list of nearby items.
Then you always have a running list of things in range.
It can be hard to use the existing collision components to get nearby items in a 2D radius. To do this, I use a box collision component for detecting the overlaps. When I go through the list of nearby items, I ignore any items further away than 1/2 the length of the box side. That way the character can pick things up in a 2D circle around himself.
answered Jan 15 '18 at 11:59 PM
Try trace complex if it doesnt work then maybe the problem is that it doesn't vet removed. And no matter if this or wont help you should use addunique instead of use.
answered Jan 15 '18 at 10:56 AM
if figured out my issue. the aks skeletal mesh with hitting and the trigger was also. i re imported as a solid mesh and it works fine now
answered Jan 16 '18 at 12:20 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here