BP Snippets

This section provides short “snippets” and examples of how to do various useful things in the plugin. I am saving things here as I example them for people that asked how to do them.

 

1.Gripping Snippets

Spawn an object on the server and grip it immediately for the client to see when it arrives

Blueprint Paste of the nodes to perform this action

These BP nodes can be used to spawn an actor on the server and grip it on the server. The client will initialize the grip when the object is received on the clients end from replication. This is the bare bones setup, you may want better socket selection / infer the default spawn orientation from the CDO of the object or handle drop distance if the player is in motion.

Notes in the nodes cover most of that.

Snap to location but keep rotation socket override

Example of aligning a hands location to the gripped object, but keeping the world rotation intact, changeable on a per object basis. The example is given as a lever component since they do not automatically look for snap points and needed additional framework.

I provided a second pastebin of how you could do it with a normal grippable which does handle snap points already.

BlueprintUE Paste of nodes

Blueprint Paste – Lever Example

Blueprint Paste – Grippable Example

4.25+ UAsset example

CustomLever_SnapExample

Spherical Object Grip Auto Alignment

Example of aligning a hand to a spherical object by overriding the VRGripInterfaces GetClosestSocketInRange function on the object.

Code uses the example templates pivot component and would be required to be adjusted to whatever pivot setup you use.

BlueprintUE Paste of nodes

Blueprint Paste

4.25+ UAsset example

BallTest

Calculate Relative Transform of hand to gripped object

Example of calculating the correct offset of a hand mesh to a gripped object.

BlueprintUE Paste of nodes

Blueprint Paste

Drop current grip and socket it into target object on overlap

Example of dropping the current grip and socketing it on to another object when they overlap.

BlueprintUE Paste of nodes

Blueprint Paste

Add a secondary attachment to a held object when a sub object is gripped (gunbase example)

Example of adding a secondary attachment to a held object in the other hand when you grip a subobject (slider for example).

BlueprintUE Paste of nodes

Blueprint Paste

Teleport an object to the grip position when the character flags a grip teleport (for custom grips generally)

Example of teleporting an actor to the expected grip position. Useful in general in some cases but mostly for custom grips.

BlueprintUE Paste of nodes

Blueprint Paste

Suggest Edit