Yes, using the Interactive Collision With Physics grip type is a constraint based grip, you can pass in specific bone names to it and it will grip at that specific bone. Also in the advanced physics options on the grip struct there is the capability to change the grip type from an acceleration based constraint to a force based one, which will give more realistic behavior with that kind of thing.
https://i.imgur.com/SE1E7xN.png
These are the physics settings that you would likely want to use for that kind of thing:
https://i.imgur.com/2bkSX6V.png
You then have to play with the grip stiffness (and/or the custom angular values) until you get a force amount that works well for you.
It sets the physics grip location to stop setting the center of mass since you want the object to be weighted correctly and turns the constraint type into a force based one. Keep in mind that Angular stiffness and damping will likely have to be a very high values as its units are different than the linear stiffness ones.
You may want to actually turn on setting the COM again if you are gripping something like a sword as it would make the pivot work better.
You can grip the same object multiple times with physics grips since they are force applicators, I actually have it on my TODO list for today to make it easier to manage multiple main grips on a single object, been pushing it off because its going to require people to re-factor a bit.
I had a suspicion that I was misunderstanding the purpose of the secondary grip, thank you for clearing that up for me!
As a follow-up question, how would I go about differentiating between grips on the separate grippable components? At the moment I have one parent GrippableSphere component with a GrippableBox component where the tape end of the tape measure is. I’ve implemented the VRGrip interface to get access to the On Grip event, but how do I know which component was gripped?
Generally the best method is to have your sub component have a method of notifying the parent, like an event that you throw from it OnGrip that the parent binds too. I don’t have default ones because generally sub objects parent containers don’t care if their children are gripped or not.
There is also the OnChildGripped event that is part of the interface as a quick way of doing , but it requires checking against the sub components. It would do if you only have one child that is grippable though as you can just cast to it and use it.
Generally by the way I would have used as grippable static mesh actor for the base, and then the end of the tape could be your grippable box. Also if you are only doing linear measuring you could use a VRSlider component to extend the tape.
Thank you again , that worked perfectly! Your suggestion to change to a static mesh grippable was a great idea, and we now have a working tape measure!
Pushed a new update to both Repositories, keep in mind that one will require some actual node changes.
I usually try and keep that kind of update to between engine versions, but it is early on in 4.22 and I really wanted to work with over the course of engine version.
Changed the IsHeld Implementation and added AllowsMultiGrip to the VRGripInterface to prepare for some future features.
See Patch Notes:
https://vreue4.com/patch-notes?section=multi-grip-changes-04-18-19
I’ve gotten replication to work except that my client seems to be taking input from the server every other frame resulting in flickering. Not sure what I’m doing wrong, but will keep working at it and post here with the solution for others.
Attaching my code in case anyone can provide an answer.
Ug…those really should be passing / returning an array of values. I wasn’t very happy about them breaking them out per finger like that when an index map would work just as well.
When I eventually make my hard coded replication i’ll be replicating them as a 0-1 scaler since it takes significantly less bandwidth.
As for your “flickering” issue, you need to ignore the “tell client” part on the owning client as its re-setting the client by not ignoring it. Also should all be on a replicated struct or something and not multicast RPCs.
Ok. I don’t know how to work with structs yet but I’ll research those when I solve . Thank you for your help.
As for the flickering. I’ll try to figure out how to get the owning client to not fire the “Tell Client” event. I figured I could do something the attached picture, but depending on whether I choose “true” or “false” it either has no effect (keeps flickering between server and client input), or the server takes over input completely and I get full mimic instead of flickering.
Sorry for taking up so much of your time. You’ve been amazingly helpful.
edit: I also tried: get reference to self -> get controller -> is Local Controller
I used plugin on my project but my characters head can still go through objects? How do you properly set up the VR Character so that it collides with all objects?
It collides with static objects by default, you need to manage other collision channels yourself as to which ones it should collide with and which ones it shouldn’t.
I’m trying to play the grab animation even when there is nothing to grab. Sounds pretty straightforward but i’m having a difficult time.
Originally I tried to set the hand state in the pawn, when that had no effect i tried to set the animation like … still no effect, where can I set the grip state? is there an easy way to do ? thanks for the plugin !
update: I found where you can switch animation modes to from blueprints to anim states so that code works now but it doesn’t transition.
I didn’t have any hand animations or copywrite free hands so I just copied Epics setup over for people that were used to it anyway. The CheckAndHandleGripAnimations functions checks for current overlap state and/or gripping state and assigns an enum value in the AnimBP to control the current hand animation.
Hi. mordental
It’s a little far from the question of VR Expansion Plugin, but would you mind if I ask you a question?
I am currently developing a Physics-based VR Melee System.(Currently I am not using the VR Expansion Plugin.)
Physical handling is performed based on the PhysicshandleComponent, but if you grab and swing a thin collision’s Sword quickly, the Hit does not occur and just passes through.
VR Expansion Plugin confirmed that problem does not occur. How did you approach it and solve it?
How does the VR Expansion Plugin manage Physics Settings?
If I use a CCD with a large weight of Object Collision and a Mesh Component, I get the result I want, but I feel that the frame is delayed when I use the CCD.
Do you have something better idea?
CCD shouldn’t have any effect on “delay”, its just running collision in substeps. Its more likely that your “weight” being higher is dragging on the constraint. Also I don’t use the physics handle component, I duplicated its setup with several changes and baked it directly into my grip controllers.
I can’t for the life of me figure out how you managed to make the capsule follow the HMD. I researched for ages and they all pointed to yet I don’t see which specific set of functions do that.
Its in the VRRootCapsule C++ source, I am overriding the physics thread update and the local rendering to move the capsule. The actual “location” is the same so it took re-writing most of the character class to use the offset location. Its likely not “the” best method, but it was a challenge and I really liked have free reign over where I place the capsule relative to the head without clunky second actors or other methods. It also lets “feet level” be actor zero, which makes a lot of sense when handling things in VR.
Back in earlier engine versions there was an AlternateLocation function on scene components thta would have made it simplistic…sad thats gone now.