Announcement

Collapse
No announcement yet.

Attaching Two Objects in VR

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Attaching Two Objects in VR

    So, in VR, the ability to take one object and snap it to a parent object is a pretty common gameplay mechanic. Snapping parts onto a car in job simulator, putting a clip into a gun, key into a lock etc. Im trying to set something like this up in ue4 with blueprints and Im at a bit of a loss. I know I need to use some kind of attach node, Im thinking AttachToComponent. I have two actors called BP_PICKUP_INPUT (a ball that goes into a hole on the parent object) and BP_PICKUP_RECEPT (parent object). Parent object includes a sphere collision volume to check if input is close enough to the receptacle to snap into place. I took the BP_Pickup_Cube blueprint and duplicated it for my input and receptacle BP's to get a starting point on handling basic pickup and release with the vive controllers. I added on to BP_Pickup_Input with a system where after the input object is released it checks to see if it overlaps with the collision sphere on receptacle. If true then it attempts to execute the AttachToComponent. So to clarify, the behavior that I'm trying to accomplish is you grab the ball with one hand, get it close to the slot of the other object in the other hand, let go and it snaps into the hole. I think where I need help is how do I properly reference the parent component so that the AttachToComponent node knows what to snap the ball to? Is AttachToComponent the right node to use? Is an actor Class blueprint the right thing to use? Do I need to set something up in the blueprint for my parent object (BP_PICKUP_RECEPT)? Am I in the ballpark or am I way off? Click image for larger version

Name:	BP_Pickup_Input.jpg
Views:	1
Size:	363.1 KB
ID:	1204899
    This is what was default to BP_Pickup_Cube, something supplied by Epic.
    Click image for larger version

Name:	BP_Pickup_Input_2.jpg
Views:	1
Size:	376.6 KB
ID:	1204900
    This is what I've tacked onto it in BP_PICKUP_INPUT. For the parent input of the AttachToComponent Ive basically been plugging random stuff in there to see if it works, which is not the most solid workflow. The system that waits till the ball is released then checks if its close enough to the receptacle seems to work as it plays a sound right after the branch, and this sound plays in game when i get it close then let go. I cant see the print screen in the headset so Ive been using sound effects.
    Any help would be greatly appreciated.

    #2
    I had a similar issue that was just worked out on my end. Check out the youtube videos from Nebula Games https://answers.unrealengine.com/que...0013/view.html

    Comment


      #3
      I got this working in this form somehow, but in my actual project I realized didnt really need to be able to retrieve objects once they were put into a recepticle, so my solution has been this. Say i have a fuse box, when im holding the fuse near the slot, a dummy static mesh becomes somewhat visible where the fuse should go to let the player know that this is where it can go (a transparent solid color material), when you let go, the dummy object switches to the actual opaque material, then in the case of the fuse it runs an animation of the fuse screwing in, meanwhile in that same instant the real pickup object you were just holding just goes into a box. Like a literal box hidden in one of the walls. I could have easily have had it destroy these actor but I like keeping them physically in the world to make loading the game easier, since all it has to do is just move those pickup objects back to where they were when it was last saved instead of getting respawned back into the world. So, kind of an odd way of doing things, but its simple and it works.

      Comment

      Working...
      X