Hi everyone. I am working with VRTemplate and working or grabbing enemy parts (hands, head, body) while preserving their animation (so they could attack you while you grab them, imagine you pull a guy’s T-shirt and he moves towards you). There is nothing wrong with the logic I did to approach this, but I have an issue with Constraints and the way they work.
Here is my logic:
-
I Added Physics Constraint component to my motion controller in VRpawn (screenshot 1)
-
When grabbing, I pass Physics Constraint, as well as motion controller with HitBone from sphere trace of the area I grab, to TryGrab Function Of default VRTemplate GrabComponent (screenshot 2).
-
In GrabComponent, I again pass this physics constraint and hitbone with motion controller to OnGrabbed event dispatcher (screenshot 3).
-
Character With Skeletal Mesh (e.g. Zombie) responds to this event dispatcher (it indeed does, I am sure), relaxes all the bones under grabbed bone, everything is okay. However, when it comes to set constrained components function, it pulls that bone towards World Origin at (0,0,0). Hit bone is valid, constraint is valid, skeletal mesh is valid and all the bones are valid too (I checked through worl location). Constraint Is where the hand is all the time. (screenshot 4)
Here is a video how it must work (I used cube that works perfectly with that code, but when it comes to vrpawn, it breaks and snaps hand to 0,0,0).
Anyone, please, let me know what can be wrong! Thank you in advance!