Hello! How I can stop VR Hands passing through walls?
Like a video - YouTube
I tried spheres with a collision around the arms, but this does not work.
If I do an attachment, then the hand cannot move.
How can this be implemented differently?
Hello! How I can stop VR Hands passing through walls?
Like a video - YouTube
I tried spheres with a collision around the arms, but this does not work.
If I do an attachment, then the hand cannot move.
How can this be implemented differently?
You have to take a look at the hand physical asset to actually make the collision work, also you have to remove that code on the tick of the bp_motioncontroller that set the collision “on” only when is grabbing something.
Just a word of advice, alyx is totally another level, Source 2 was made with VR in mind, ue4 was not. So the result will not be the same. Walking dead Saint and Sinners is unreal 4,thats probably a better game to "be inspired "
It’s a little heavy, but consider not attaching your visible skeletal mesh hands directly to your motion controllers like the default VR setup does. Instead, place the visible hand meshes in your pawn and then use the location of the invisible motion controllers as a target to constantly sweep them towards on tick. This way they will track like normally out in open space, but if they have collision and sweep into a wall along the way they will stop short.
A couple of things to keep in mind though: 1) Make sure the physics material on the visible hand collision is set to frictionless so they will glide along that surface and not get hung up as much. 2) A straight line path directly to the motion controllers is not always the closest position they can get (say your hands are inside a wall at an angle for example) … one way we’ve solved that is to try and sweep X then Y then Z in three steps instead of doing the whole transform in a single sweep. And finally 3) You’ll want to distance check how far away they are and override all this after some max distance. An example there is let’s say your hands are under a table and you lift up thru it - you can definitely get to a point where no matter where you are, those hand meshes will stay stuck under that surface indefinitely. So you could say ok if the distance is greater than 20cm, turn off collision, pop them back in place, turn on collision again.
Hope this helps.
Hi @1l2Hawk, for your 2nd point, is there a way to choose for which objects the hand mesh needs to stop ? I mean collide and stop against static meshes, and collide but move dynamic ones (physics actors). With a simple sweep move, the hand mesh stops against physics actors too.
Also for the 3rd point, one other possibility is to set up the bSweep parameter of the SetWorldLocation node : check the distance betweed both world locations of hand mesh and motioncontroller, check if >20cm, and send the boolean result into bSweep. It avoids playing with collision.