C++ Get Hand overlapping button from widget

Hi! Im working using c++ to create haptic feedback, I have a child button (parent is button from the UE4 Engine) , I create it in order to change somethings, but Im not able to access the hand overlapping the button , is there a way to do this? should I try to find the hand or the laser? Im kind a lost atm…

It is possible to identify the position of the hand. You could do it by position - work out the proximity of the hand to the button and within a given distance, treat as pressed.

Also, You could use a collision volume to the controller/hand blueprint and then add overlap events - you probably want trigger rather than collision so you don’t collide with yourself.

That proximity solution sounds good, how could I do that?

You have to be aware of the button and the hand. Then, get the position vectors for each and subtract 1 from the other. It doesn’t really matter in which order. Then you want to get the size of the vector and get the absolute size of it, thus removing the sign. Then, you can test this value against a defined distance to see if it is less than the distance you want.

Truthfully, the hardest part of this is the hand knowing about the button OR, more likely, the button being able to find the correct hand. the FVector should have all the necessary methods to do the rest.

If it is a collider you use, it just triggers an event when it collides with something and you check what it has collided with. This would probably be the easier solution to implement.

This sounds really good, I will see if im able to replicate this… I will let you know how it goes, thanks!

1 Like

This is sort of covered towards the end of the first part of the course - hand controllers are created which are used for climbing. It does this by detecting contact with blocks and then the rest, for your purpose at least, doesn’t matter but it calculates an offset enabling the user to pull themselves up to the next grip.

I was thinking of this , the first solution, it may not be the perfect one , because it can happen that not always the nearest hand , is the one overlapping with the button, sometimes you may be using right hand to target the button, but the left hand is closer than the right one.

Yeah I havent take the course , my bad, I have it on pending, pretty sure it is great! I have found some solutions on it so far…

Privacy & Terms