Since I got many requests for it, here it is. This is just one of the many possible techniques. Note that, to keep it simple, the VR hands are not detached and attached to the weapon while holding it. I may cover this in a follow-up tutorial. Enjoy!
This is coming at just the right time for me.
Thanks VR_Macro
Great! Let me know how it works for you. In hindsight I could have placed the pivot point for the weapon rear grip a bit higher so it looks nicer/more realistic while in the hand. You may want to do that.
Great job !
Thank you / Grazie!
sorry to bother you macro But I have followed this tutorial and and My second hand wont attach. so I followed it again in a new VR template and I still have same problem.
I really can see what I have missed and I have been looking .
Does anyone see anything I have done wrong,
At first sight the Blueprints look correct to me. Are you sure your Secondary Grip Area is generating Overlap events?
I just added a textrender component to a visibility node connected to the is hand tracking boolean and nothing was working , so it looks like the overlap event is not working.
but I dont understand why.
But I have been going through a lot of this lately where very simple things refuse to work like the engine is fighting me back.
Are you using the standard hands from the VR template or something else? Overlaps need to be enabled for both for the event to trigger properly. If your overlap event is not firing, that would explain why the 2nd hand is not attaching.
Got it working
I started from scratch again in a brand new project, followed the tutorial again and it worked right away, I migrated it to my VR project and it stopped working again.
Turns out it was casting to the wrong motioncontroller BP because I have a few custom ones I have created.
I already Tried to fix it and changed the cast BP,but missed that the connection between set second hand and motion controller was broken Doh!
But I now also have it working with my Custom VR project now Thanks Again.
Cool! Glad you found the issue and solved it. Indeed, when migrating from one project to another sometimes castings have to be recreated.
Hi. .
It’s a bit different from the topic of Tutorial, but let me ask you a question.
I am now handling objects through PhysicsHandleComponent.
Applying it to the SetTargetRotation function of the PhysicshandleComponent via 's VR Two handed Rotation logic will cause it to rotate strangely.
It works well with the standard AttachTo.
I’ve tried many things and I don’t know what’s causing them.
Could you tell me what went wrong?
Difficult to tell without having seen your code and what the problem looks like. In principle it should work in the same way. You can try to debug it by using some visual cues, like Debug Lines or arrows to show the orientation.
Thank you for answering the question. .
I figured out the problem through debug.
I changed grabbed weapon’s relative position and rotation when I took it, and I did physics handling based on that value.
The biggest problem above is the error of the rotation value depending on the Relative Rotation value.
I’ve tried a number of things to solve this, but I have not had a good idea yet. What do you think?
Can you use a local rotation rather than a relative one? That would be easier to handle. Not sure where your “error” comes from. Can you explain?
Hi,
First of all I’m very new to UE4 so tutorials like yours are very helpfull.
For my VR project I need the player to grab a chainsaw with two hands. The first and second hand placement are not in a straight line like the example rifle in your tutorial.
The first hand grabbing is working great, however the second hand snaps to in front of the first hand in stead of slightly up and to the left where I placed my second hand trigger.
I would be very thankfull if someone could tell me how to fix this.
Thanks in advance!
@NoBubbles That is strange because we attach the second hand by detecting an overlap with the front sphere. Did you try to make the front sphere slightly smaller? Does it also happen if you approach the chainsaw from the top?
@ Please see the attached video. I changed the size of the front sphere and tried grabbing it from different angles, however, nothing changed. As you can see as soon as my second hand is inside the front sphere and I press the trigger it “teleports” my second hand to be in front of my main hand. I tried moving the sphere ± 30 centimeters to the left for testing purposes, but even then when I grab “in the open” my hand gets “teleported/snapped” to be in front of my main hand.
Ok got it. The video helped. The problem is not that the hand snaps down, is the chainsaw that snaps up. What you need to do is to add some negative pitch angle to the world rotation of the chainsaw. On event tick, before feeding into SetWorldRotation, subtract 50 or 60 from the pitch (Y) angle. Experiment with the values. You should see the chainsaw bending down until the second hand is where it should be. Let me know how it works.
Would be better off getting the initial offset on the second hand gripping and tracking the look at to that offset instead. Wouldn’t require any manual adjustment.