Using Vive controllers with physics handles

Ok I am struggling through trying to patch together multiple tutorials and take bits from each and come out with the result I need but so far I am not having luck. I was able to recreate the blueprint from the twitch broadcast about motion controllers and I could then pick up and drop snowballs. (Throwing snowballs is the point of this blueprint) The guys in the twitch broadcast added an impulse to speed the throw upon release as they were turning off physics when attaching to the controller and then reinitializing the physics upon dropping it. I don’t really like the idea of that for my project and I would much prefer to maintain the physics during the motion of throwing the object as it should then feel much more realistic that the snowball uses the force and trajectory of the throwing motion to speed it on it’s way (or to lob itself lightly or whatever the particular throwing motion created by the user is.)
Anyway I am fairly sure it’s possible (the zombie trainer game on Steam VR that I have played a lot of already seems capable of throwing grenades and meat and various physics objects fairly naturally though I believe it was created using Unity.)

So my current blueprint is attempting to create a physics handle on the hand controller and store it in a variable and then use the grab component node to attach it to my hand collision object. 25defb10b0cc5528f648cbd46cc4b36db20819fa.jpeg

I have tried various ways of attaching these nodes and using different variables and such. Honestly my brain is starting to melt right now and I figured I would reach out and see if anyone feels like saving me some pain. I have also been watching a couple of youtube tutorials about using physics handles and those seem to give the behavior I want but I was trying to merge them with the motion controller demos since there are aspect of that that I prefer. Oh and another difference between my method and the physics handle tutorials I found is that they are raycasting to find the pickup object and I chose instead to use an “on overlap” with my hand collision object/trigger to signal an object as being in range to pick up.

I think this might be easier if I more thoroughly understand the Physics Handle Component and the Grab Component nodes and what they require. My instincts from watching the tutorials tell me that the Physics Handle Component is like a position constraint in Maya but I guess what I fail to understand is how to hook it up to something in the chain of nodes in blueprint. How can I tell UE4 that upon overlapping a physics object and pressing the controller button that I want to create a handle that tracks with the position and orientation of my Vive controller and then when release the button it will release the physics handle and let the physics take over to let the inertia generated from the throwing motion propel the object along it’s course. I am fairly certain my problem is somewhere with making the handle follow the controller. How to I get it to parent to the node I want it to track?

Oh and do I need two physics handles? I was wondering if I need one for the pickup object and one for the hand controller. I haven’t tested that theory yet.

You forgot to give the grab node a physically simulated component to grab, and also you will need to update the target location and rotation to match your controller position in your tick event.

If you do this then it should work. Just remember to update the target location and rotation in your tick event and all should be good. We have been doing it this way for all of our weapons, objects, ect. that needs physics interaction with the player.

Well I had tried to attach the physics handle to the collision sphere that I have parented to the motion controller. I was hoping it would just follow that based on the parenting but I guess I have to manually make it calculate the position of the motion controller on every frame with that tick event?
I had tried some versions where I had the component node on the grab component hooked up to the collision sphere and other times I tried hooking it up to the “picked up item” variable. I guess that is my problem. I don’t know what inputs are supposed to connect where. Is the component input expecting the component on the motion controller that I want to attach the physics item to? Or is it expecting the physics handle itself? It would be nice if I could just mouse over an input and have a tooltip say “Hook up the thing you want it to follow here”.

Anyway I noticed the tick event script in other tutorials and haven’t tried that yet because I was hoping it was redundant if I could get the parenting/constraint idea to work but I guess not. Maybe that’s the only thing keeping it broken… I will let you all know. Thanks for the tips.

Ok so I got it sorted out. I still need to hook in some of the old way I was doing it for the purpose of picking up weapons but for now I can pick up and throw snowballs. Mostly I followed this tutorial and made the alterations necessary to have the hand controllers hold the physics handles instead of the camera.UE4 Tutorial Physics Handle Grab Objects - YouTube was trying to avoid raycasting so much (I already use it for teleportation) cause I thought that using an collision overlap might be more efficient and less calculation intensive? Oh well. At least I got it working. Now I just need to tweak the physics to make the throw feel more natural.

Ok so I have gone back to this blueprint and I am trying to do something different now. I wanted to improve the throwing physics so I hooked up the physics handles and that seems to help some though I still need to tweak the mass and dampening and so forth. For now though I am trying to adapt my blueprint to achieve this: I want to check for an overlap with an object tagged as “snow” and when overlap begin = true then it enables the grip button on the controller to spawn a snowball on press. (So you are basically scooping up the snow and spawning it into a snowball.) So far I have been able to get the overlap event to be able to spawn the snowballs on the button press but I can’t seem to hook up the physics handle to grip the snowball. It occurs to me that the problem lies in the fact that the snowball doesn’t exist in the scene until I spawn it so I don’t know how to make the physics handles grab a component of the snowball. Basically I need to be able to reach into my “snowball” blueprint from my motion controller blueprint to get a component (or store that component in some sort of public variable accessible by the motion controller blueprint?) Anyway… I am fairly certain that is the last broken link in my chain and I just don’t know how to get that data from the spawned actor for the physics handle to grab on to. (The raycasting variation of this uses the break hit result and takes the “hit component” node out to hook into the component link on the grab component node.

What I would do is when you push the button create a snowball on the hand. Then on the hand create an on overlap event and cast to a snowball blueprint. That’ll give you access to the snowball blueprint. Hope that’s helpful.