How to make an Actor/Object move into a certain position in your VR hands (Unreal VR Template)?

Hello, I am curious if anyone could show an blueprint example of how an object upon picking it up with your VR controllers will lock into a certain place with a certain rotation?

For example, I would like to pick up an Axe by the handle and I would like the blade to be pointing forward.

Any idea on how to set this up? I have seem something about sockets or attach to component, but I do not quite understand the right info/variables to input for the proper results.

Thank you.

Your first and easiest form of control is to make sure the mesh you are attaching to the hand has its origin point where it will be hold naturally and that the orientation of the blade in the mesh is toward the positive X if it has to point forward. Then you can use AttachToComponent with Snap to Target both for Location Rule and Rotation Rule. In this way your axe should naturally fall into place.

Another method, if you wanted different points/transforms for different objects to align in the hands correctly is having each object have a hold offset that you use against a main grab point (Possibly in the centre of the hand). When you grab the item, compose the transforms of the offset and the hold point (To find the position in the world you are going to place the object in relation to the hand). Then using this new location, set the World location/rotation of your object you are grabbing, which will be in the correct position of the hand.

You can then attach this to the hand, but instead of using Snap To like Marco mentioned, use ‘Keep World’ as the options, so that it stays in it’s current position but not attached to the hand.

It does require a little more work and you have to fiddle with the offsets a little, but if you implement an interface, you can then have the offset position on each of the objects you might want to pick-up and position into your hand.

@vr_marco

Thank you. Can I change the origin points inside of Unreal? Is it the same as using the Alt-Middle mouse button to change the pivot point? Or do I need to take the mesh into a 3D editor, change the origin point and re-import?

@Dune

Thank you, but that seems a little confusing still. Are the “Offset Transform” and “Current Hand / Grab Location” variables? What would I use to set those variables? Event tick?

Thank you both for responding.

Add OffsetTransform variable to PickupActor blueprint, initialize it with required value and use in Pickup event. You also can make it without Current Hand/Grab Location. IN this case, call AttachToActor, then call SetActorRelativeLocationAndRotation(OffsetTransform).
Also, see my imlementation: How to position Picked up items & Weapons in VR Hands correctly?. - VR and AR Development - Unreal Engine Forums

Easiest setup is just to add a socket to the root mesh and on grip check for a socket of that name (GripSnapPoint, for example).

If it exists, attach at that offset relative transform, if it doesn’t, then attach at the contact point for free gripping.

This lets you visually set the offset transform (rotating and moving a socket on the mesh) and is the easiest to change and mess with (as well as supporting multiple locations).

Might the developers at Epic eventually release a VR project that starts with Oculus Touch ready hands ? (with the release of the next engine update etc)

I just noticed this is form 2017!

1 Like