VR Expansion Plugin

Okay, I’m having trouble with creating a holster or slotting system. It’s gripping but not by motion controller(s). Most common is pickup a sword and holster it to your hip. If I AttachComponent then gripping no longer works to unholster the sword. I was hopping to find a example of where any actor can perform a grip action not just the grip motion controller component. To me it the same issue if you build a gun with parts you can attach (different sights - upgrade gun by attaching components). The parts would be grip but then need ability to attach/unattach/swap. Any idea how one accomplish ?

Gripping works fine on attached things…if it is not an attachment grip or a physics grip (both of those automatically remove attachment by their very nature) then it will need to be detached OnGrip though, I do not automatically call Detach as in some cases you will want it to remain attached and I do not assume.

As for holstering FROM a grip, calling DropAndSocket is generally the best way as it is an all in one node for that, but dropping and then attaching is also fine.

In a general contextual sense Attachment is exactly what you are looking for regarding scopes / additions…there is no general “grip” system and one would be a far worse use for that case than just attaching. I think you may be a bit confused about how the engine works in general, every scene component or actor that is a “Child” of another one is “attached” to it.

You can look at the Potion and the Gun in the template for how they current dictate attaching to the waist on drop as well.

Okay, I missed the call to ‘Set Simulate Physics’ off on the static mesh component. I did not realize you could holster the gun or potion to your body anywhere. In the Gun case I see you implemented RequestsSocketing override. I just totally missed when going through the tutorial room stuff. Okay, so I get how to do properly with the plug-in.

I also looking to do some really advanced dynamic socketing. In my current implementation which I’m trying to convert to your plugin, I define a spline along the handle(s) of the weapons where a gripping is allowed. A marker is displayed where the final grip will occur along the spline based on where the hand is located. Like your VRSlider but the cube moves to be near the hand along the spline and OnGrip the cube marks the grip location. So to do i have to highlight the item (weapon) based on hand proximity or hand jedi pointing at a weapon. Best to use RequestSocketing and your VRSlider to implement style of gripping?

You can switch a held objects grip type to custom when it overlaps your area and manually handle tracking it to the spline it you want, the grip types are able to be set live.

It would be a good use case for a grip script though, you can either have one already on the item or add one live when its within the area that takes a spline and forces the held object to follow it.

Okay, I missed the call to ‘Set Simulate Physics’ off on the static mesh component. I did not realize you could holster the gun or potion to your body anywhere. In the Gun case I see you implemented RequestsSocketing override. I just totally missed when going through the tutorial room stuff. Okay, so I get how to do properly with the plug-in.

I also looking to do some really advanced dynamic socketing. In my current implementation which I’m trying to convert to your plugin, I define a spline along the handle(s) of the weapons where a gripping is allowed. A marker is displayed where the final grip will occur along the spline based on where the hand is located. Like your VRSlider but the cube moves to be near the hand along the spline and OnGrip the cube marks the grip location. So to do i have to highlight the item (weapon) based on hand proximity or hand jedi pointing at a weapon. Best to use RequestSocketing and your VRSlider to implement style of gripping?

? You just repeated your prior post

I had an issue with skeletal meshes where the root bone is not the base where physics body root is causing were grip rotations. I added logic to correctly find the root physics in the skeletal mesh and resolves issue. Don’t know if any other user has hit issue but I did.

           // I actually don't need any of  code anymore or the HandleInfo->RootBoneRotation
            // However I would have to expect people to pass in the bone transform without it.
            // For now I am keeping it to keep it backwards compatible as it will adjust for root bone rotation automatically then
            USkeletalMeshComponent * skele = Cast<USkeletalMeshComponent>(root);
            if (skele && skele->GetNumBones() > 0)
            {
            // RJM - Was    RootBoneRotation = FTransform(skele->GetBoneTransform(0, FTransform::Identity));

                // RJM - Not all skeletal meshes have root bone as 0 for physics
                                // need to know which one it is.
                int rootBone = 0;
                FBodyInstance* rBoneInstance = nullptr;
                for (int bone = 0; bone < skele->GetNumBones(); bone++) {
                    rBoneInstance = skele->GetBodyInstance(skele->GetBoneName(bone));
                    if (rBoneInstance != nullptr && rBoneInstance->IsValidBodyInstance()) {
                        rootBone = bone;
                        break;
                    }
                }

                RootBoneRotation = FTransform(skele->GetBoneTransform(rootBone, FTransform::Identity));

                HandleInfo->RootBoneRotation = RootBoneRotation;
            }

Thanks for your thoughts on the spline grip case. I have to experiment with what will work best.

Mmm, that is a valid point, though I am unsure as to why you would be using a non 0 root for a physics simulating body.

I added something like your logic to it, i’ll port it back to 4.20 / 21 as well.

It’s caused by exporting meshes from UE4 to Maya and then reimporting. UE4 adds a new root bone which the artist did not realize was happening. Now it’s to late to fix by redoing the assets over again.

Well I implemented revised logic to get the first body (much like yours), I believe that one or two people reported something similar in the past but were never able to give me a good reproduction.

So thanks for the contribution.

Its ported from 4.22 back to 4.21 currently.

Question,

I’ve been trying to add a system that allows the user to either pull or push gripped objects closer or further away from themselves. However, I’ve been unable to figure out where I am able to set the world offset setting that gets set when “Grip Component” gets called. Using add relative transform or update relative transform causes the object to fly away, and setting the gripped object’s world location doesn’t update the grip’s world offset, causing objects to ping back to their initial grip position. Are there any examples of functionality? Best example of what I mean is similar to the grabbing system in “I expect you to die” where you can slide objects along a tether so to speak.

Thanks

Unsure what that is like as I have not tried that game but setting addition transform will work. You’ll want to rotate the vector of movement by the controllers orientation relative to the object. You can get the current relative transform by breaking the Grip structure and even directly set that yourself.

Add relative transform won’t work unless you are doing an attachment grip as relative transform is in world space in all other grips. Also setting its world location also wouldn’t work as you found out because the grip logic keeps moving the object to the correct location.

I would take a look at the gun in the example template, how it handles recoil is using the addition transform and you can abuse the same kind of logic to move your held object.

If you find the addition logic too complicated you can also use CustomGrip type and manually move the object as you wish, or switch over to it from another grip type live.

Edit Alternatively in newer versions of the plugin there is the CustomPivotOverride that you can set, it lets you assign another scene component (not the controller) as the base point for grips, makes things like significantly easier as well as you can just move that base component around to adjust the final location.

As seen in video:

You use it by setting like below (preferably BEFORE gripping something, like in begin play).

https://i.imgur.com/yH9CYQb.png

Here is a video going over something I am playing around with in 4.22 beta.

Ah those laser pointers are basically what am after! Only difference is that they can be adjusted in length so to speak. I’ll have to look into using that custom pivot, sounds like what I am after.

Also minor thing, Unforgiven was renamed to “Virtual Escape: The Play Room” on your list of games that use the plugin. Also, the game is undergoing updates that will bring it to use the latest version.

Thanks again for plugin, amazed at the amount of time you put into it after all time!

EDIT:

Custom pivot was exactly what I wanted, works perfectly!

Cheers

Hi everyone.

So I have run into an issue, I am new and have stayed on 4.20 and never updated (scared after being an apple user making music professionally for over 20 years and dealing with nightmares from updating) so I lived under the if it aint broke dont fix it rule. I do not know the proper way to update, and I dont know how to update with the VRE at all.

the reason I need to update is because some plugin never made it to 4.20 for some reason and I would like to use it.

I see on the branches that even my 4.20 was updated but it says locked but it seems like people are updating it? I see comments and things changed just yesterday. so it seems that my VRE that I downloaded in sept 2018 is not the same anymore.

https://bitbucket.org//vre…/?tab=branches

if I was to update to the new 4.21 how would I go about it? also, has anything changed? I hear 4.22 has alot of things changed for VR performance has anyone heard about ? Something about the meshes and lower polly counts.

Master branch is always the latest branch, I port back patches from master to older branches if they are clean merges which is why the locked ones still see activity.

When 4.22 comes out it will be master and 4.21 will be locked.

As for how to update I replied in discord for you regarding that.

Updated the game information

Getting some issue porting the template to 4.20. I have about 137 “failed to load outer for resource” errors.

I migrated the 4.20 plugins into the “Plugins” folder, and built the .sln file. I get no other errors, only once I open the UE4 project filed do I receive the load errors.

Is there something I am missing? I was hoping to peek under the hood of the Vive Pawn Character

Download the 4.20 template branch, you can’t backwards convert BP’s for the most part.

https://bitbucket.org//vrexppluginexample/get/4.20%20locked.zip