mordentral
(mordentral)
September 18, 2020, 4:32pm
4360
Qianfulong:
Hi,
i’ve got a question regarding secondary grips. I am trying to implement an object, which while being hold by the main hand, spawns a certain object when the secondary hand grabs it at a certain position. Think a magazine and it’s bullets. I am trying to use a custom secondary grip for that. However i do have two questions here:
How do i tell a secondary grip of type “SG Custom” to use a slot, so that the secondary grip event is only fired when the secondary hand grabs near that slot? I tried to use a “VRGripS1” socket on the mesh but that does not have any impact.
That is behavior that you would change in your control code likely, have it not call the grip if its not over a spot, the plugin itself doesn’t handle that logic to leave it open ended for whatever you may need. The template implements basic secondary grip logic but doesn’t handle anything special around the custom secondary type. You could also let it secondary grip and only run the logic if the relative transform is close to the socket or on it.
When doing the secondary grip the “OnSecondaryGripAdded” event fires just fine. However only for the very first grip action and it also seems that the “OnSecondaryGripRemoved” event does not fire ever, even when the secondary hand lets the grabbed object go. How do i get the “Added” and “Removed” events fire as they should do, namely everytime the secondary hand grabs or lets go?
They already should be, it sounds like you aren’t actually letting go there when trying to re-use the action, generally that would be a OnSecondaryUsed event once already secondary gripping.
How do i remove the secondary grip manually in the BP? Imagine : The secondary hand grabs the object and the object to be spawned gets spawned. Since i want to grip that spawned object inb code i assume, that the secondary grip has to be removed first, in order to then be able to grip the spawned object in code.
No, you don’t have to remove a secondary grip to grip something, a secondary grip is a grip modifier, it is on the primary hands grip structure. Also for future note, even if it was a full grip, you can have up to 128/128 (local and server authed) grips at the same time on each hand.
Cheers for any help on !
Responses edited in above, however I will note that I think you are approaching wrong likely, it sounds like a better case for using a grippable collision body or hidden mesh component on the object at the point that you want, and running all of your logic off of OnGrip instead, it could be a full subclass dedicated to being a spawner and would make your logic both easier and more modular.
Also, since you aren’t “actually” gripping anything here, you can entirely bypass the grip system and just throw interaction events however you would want as another method.