Table of Contents

Vibrate a controller on grip button press

This VCI vibrates a controller when a grip button is pressed.

Example data

https://virtualcast.jp/products/5dfddae440784a11754b606a5b5246e00c33b6f59db737ff5ebd2c256f39f574

vibration_vci.zip

Material data

You don't need any material to create a vibrating VCI.
Prepare a 3D model based on what you want to create with VCI.

Component setting

You can easily check this by creating a grabbable SubItem.
Also, set the component as shown below for easy handling.


Script

main.lua
function onUse(use)
    -- use stores the name of grabbed SubItem
    vci.assets.HapticPulseOnGrabbingController(use, 3000, 1)
    print("Vibrate a controller which used"..use)
end

VCI Script (Description)

The argument “use” in onUse(use) contains the name of the used SubItem as a string.
By using the “use” as the argument on the vci.assets.HapticPulseOnGrabbingController(use, 3000, 1), you can vibrate a controller with any objects when used.
The second argument specifies the strength of vibration (0~3999); the third argument specifies the length of the vibration. HapticPulseOnGrabbingController

If you want the vibration to occur with a specific SubItem only, you need to separate the process with “if” statement depending on the used SubItem.