Hey guys, I am working on a beginner project for me to learn ue4 better as well as VR. I am looking for tutorials that will help with better sword mechanics like in this link - https://evanfletcher42.com/2018/12/2…hanics-for-vr/. Only issue, this is in Unity. He works with what’s called springs and motors inside of unity and I tried finding the UE4 equevalent and with no luck. Please tell me a kind soul out there has some documentation on this topic? anyways much love!
In Unreal, its called physic constraint. But its very hard to make constraint works the way you want if you are a newbie in game dev. You have to do some math that will take month or even year to learn and work with it. The easier way is to use physic handle. Although its not the perfect way like constraint, its very easy to setup, The spring are angular damping and stifness, linear motors are linear stiffness and damping in physic handle. Good luck!
Don’t think it would be difficult to change from [sword attached to motionController] to [sword attached to physicsConstraint attached to motionController]. I can’t find a good tutorial for activating physics constraints in blueprints, but you can start with these nodes:
“set constrained components”, use this to initialize the constraint. It has two inputs for constrained components, your motion controller should be component 2, the object you intend to pickup should be component 1.
“break constraint”, use this to drop objects
“set constraint reference frame”, if you pick up an object that seems like it won’t snap into your hand, use this node with a zeroed transform to force it there. (This node uses weird inverted transforms to position objects in the constraint to non-zero positions, I’d say it’s very difficult to use for that purpose).
A physicsConstraint component should be attached to your motionController component in your blueprint.
Hey! You cant always zero the frame position, in situation like multiple grab points. And even the setup you provide above is wrong if you want to use constraint to pick up something. Its very difficult ya know. The hardest part is not the position , but the rotation. You cant directly calculate the rotation from world and invert it to local, you must calculate it from local frame to frame. And its a nightmare for someone that just have a hand on this. You also must have a very good knowledge about quarternion calculation.