Droping an object

Hello. I would like to make a script to make the user drop a specific GameObject, but I don’t manage to make that.
Can someone tell me how to make that?

You mean holding an object in your hand and then if that object is the one you want to drop, then drop it?

Then you can do it by the name of the gameobject since tags doesn’t work in Udon:

if(gameobject.name == "MyObject") {
//For more flexibility:
if(gameobject.name.Contains("MyObject")) {

yes, that’s it. Typically, I would like to make the player drop the key after it got entered into the lock, so in first, I made the key get invisible, but the player is still holding the key in the hand.
Here is my stuff :

The thing is, if I don’t link the block to the VRCPickUp.Drop node, the lock doesn’t get invisible,otherwise, it’s invisible (expected behaviour).

The VRCPickupDrop node is expecting a VRCPickup component for the instance. So for the type on the Get Component Node, provide the VRCPickup type.

Additionally, I believe since you are turning off the key before dropping it, it may not respect the drop instruction. Try putting the drop block before turning off the key. They will still execute on the same frame, but in the right order to drop the key.

The Drop instruction should look like this:

1 Like

Neat, that works. I didn’t see what to do with the output “type” on GameObject.GetComponent
You fixed my issue, thanks :heart: