Translations of this page:



Rumble a controller on grip button press

This article was written for “UniVCI-0.15.”

Example data:

To execute a process when the grip button is pressed, use “onUse”.

In this example, we will create a process that rumbles a controller
when the grip button is pressed against a certain “VCI SubItem”.

1. Create a new GameObject and create a Cube as its child.

In this example, we named the GameObject “Vibration_VCI,” but it can be anything really.
Let's name the Cube “Cube.”
Specify Y-axis value of the Cube to 1 so that it doesn't go through the floor.

2. Attach a “VCI Object” component on the GameObject,
and attach the “VCI SubItem” component on the Cube.
When doing this, “RigidBody” components are also attached automatically.
As the Cube won't be using gravity, turn off Use Gravity and turn on Is Kinematic.

3. On the VCI Object component in the GameObject, set the Scripts Size as 1.
Enter “main.lua” in the Name and paste the script shown below.

local Cube = vci.assets.GetTransform("Cube")
function onUse(use)
    if use == "Cube" then
        vci.assets.HapticPulseOnGrabbingController(use, 3000, 0.1)    --Rumble the controller
en/vci/sample/onuse/no2.txt · Last modified: 2022/03/06 23:11 by Ramen

Page Tools