Hello All, I’m struggling with a problem. I need to set up the logic for two different ways to pick objects up. 1. Pressing the trigger picks up the object then pressing trigger again drops obJects. 2. Press and hold trigger to pick up release to drop. I have all of that logic done but I can’t seem to set it up so that it checks whether the mesh requires being clicked or held. If anyone has dealt with this I would really appreciate some help been stuck on this for a week. I can also clarify if this doesn’t make sense.
Hey Rockafelia, do you have any updates on this? I’m very interested on your progress. I’m working on a project that may need a similar mechanic.
Could tagging help in this case? You can tag the meshes to pickup with method 1 differently than those to pickup with method 2, then check the tag at the time you are interacting with each mesh to apply the proper handling method. Just an idea, but it is possible I have misunderstood what you are actually asking.
Cheers,
Marco.
Either derive them from a base class that has an accessible variable Enum like “GripReleaseType” and cast objects to that base class and check for what the enum is set to.
Or add an interface and call an interface function on the object to get GripReleaseType.
Hey thanks for the reply. Ive been using interfaces for the pickup drop and I created one called “pickuphold”. The pickup hold I added a scene component (Attach To). I think all of my blueprints are correct though I don’t have very much coding experience so I most likely am wrong. The basic VR Template has a function set up for grabbing so im trying to integrate a check into that grab functions that basically determines if it is an object that requires holding down the trigger or if its click to pickup I however have no clue how to do that.
Hey not much luck yet as soon as I figure it out ill post some screenshots showing what it was.
Cast the object in the grip function to the interface, then call the interface function you want, you want to add another interface function, one that returns a boolean and is something like “IsPickupAndHold” to check the type.
A way to do this (and how I do it in my VR Content Examples) is to flip your thinking on this, change your interface functions from Pickup and Drop to PickupPressed and PickupReleased. See when you say Pickup and Drop you are then deciding in the Pawn what constitutes a drop but to get the most flexibility you really want to decide this on a per object basis (maybe and object can only be held for 3 seconds etc.). After changing those interface functions, then on the torch in your example all you need to do is to do a flip-flop on your PickupPressed that picks up and drops, but if you wanted it to be dropped when released simply drop on the PickupReleased message
That makes much more sense thank you for the response!