Spawn object in hand and bind it to hand transform?

Hi there, I am trying to implement a simple VR darts throwing game. I want it to work so that pressing the trigger on the Oculus touch makes a new dart spawn in the user’s hand and bind it to the hand’s object attachment point orientation and position. I have created a new action binding in the SteamVR interaction system to spawn a dart in the hand, and it works.

The problem is that I want to use the trigger to both spawn the dart (by instantiating the relevant game object) and “grab it” thanks to the built in interactable script at the same time. The dart having a rigidbody using gravity attached to it, tends to fall off when I try to grab it, and it will only attach to my hand if the controller is in a particular orientation. Can anyone think of a simple way to make sure that the dart spawns and stays attached to my hand properly until I throw it?
Thanks in advance!

@el16al I have a 3d RPG game I’m making. My player picks a “magical flower” & it becomes a sword in her hand. To accomplish this I have made TWO identical characters BUT on the 2nd one I have added the sword. So when the player collides with the “fake sword” (or clicks on it to pick it up in your case), the 1st player is “SetActive = false;” and the 2nd player is “SetActive = true;”. I do this on another quest in my game if the player is holding the “flower sword” and has to trade it to the NPC for a “butterfly net”. I have 2 of both, 2 flower swords (1 named “fake sword” & 1 named “real sword”) and set active according to what the needs are. You can swap out “right hand” on your first person (guessing here as I know nothing about VR) NOT holding a dart, and swap in a new “right hand holding dart”? I hope this helps!

@el16al I had the same problem and used ‘SteamVR_Action_Single’ (which gives you a float), instead of ‘SteamVR_Action_Boolean’ to resolve it.

You need a handler like this one:
OnSpawnActionChanged(SteamVR_Action_Single fromaction, SteamVR_Input_Sources fromsource, float newaxis, float newdelta)

…and e.g. check if (!alreadySpawned && newaxis > 0 && newdelta > 0f)

Then, the important part is to make sure there is the SteamVR “Throwable” Component on your GameObject which you want to spawn & throw; there you need to set the property “Catching Speed Threshold” to e.g. 0. This way, the object will be attached as soon as it was spawned.

Hope this helps in a way.