Hi.

I am trying to create a system where swords are repelled in VR games.
We are currently using the weapon viewer to display the swords.
The weapon has a Grabber script (VR Interaction Framework) that is unique to the VR system.
I would like to use that script to make the hand hold the weapon.

However, the attacks only hit with the equipped weapon.
I can't use the ORK HowTo's trap system because it requires attaching combatants and abilities to the weapon prefabs in advance, which is not convenient for maintenance.

How do I drop an equipped weapon to the ground while it is still usable?
  • The equipment spawned by the equipment viewers have a EquipShortcutLinkerComponent attached, which give you access to the used equipment via the Equipment property.

    You can use that to equip/unequip the weapon.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Thanks for the answer.
    I have been too busy with work to try it.

    Question 1
    Is the ↓ method correct?
    I don't know how to get the EquipShortcut type.

    EquipShortcut weaponShortcut = ?
    if (combatant.equipped)
    weaponGameObject.GetComponent<EquipShortcutLinkerComponent>().Equipment = null;
    else
    weaponGameObject.GetComponent<EquipShortcutLinkerComponent>().Equipment = weaponShortcut;


    Question 2
    The method of using the above script seems too difficult for me, so I am considering using GlobalEvent when the button on the control map is pressed.
    I've looked at the Equipment setting in the EquipCondition of GameEvent, but I can only see how to select static weapons (for example, in the ORK ShortCut setting, I can only see how to select a fixed "ShortSword" from the pull-down menu).

    What I want to do is.
    If you press a button on the control map, you can use ShortCut to remove the currently equipped weapon.
    If I press the control map button again, I want to equip the weapon that I had equipped last time.

    What is the best way to do this?

    Translated with www.DeepL.com/Translator (free version)
  • 1) Well ... that'd depend on where you want to get the equipment from, e.g. from a combatant's current equipment (e.g. a specific part) or from a game object that's shown via the equipment viewer, or just from the inventory?

    2) Check out the selected data feature.
    You can here e.g. store the currently equipped weapon using a Select Equipment node or get one from the inventory (Select Item node) and use that in other equipment nodes.
    Via global data origin the stored data would also be kept during gameplay (but not in save games) and you could switch back like that as well.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Sign In or Register to comment.