This site has been permanently archived. The content on this site was last updated in 2019.
Stay organized with collections
Save and categorize content based on your preferences.
This class is used by GvrPointerInputModule
to route scroll events through Unity's event system.
Summary
It maintains indepedent velocities for each instance of IScrollHandler
that is currently being scrolled. Inertia can optionally be toggled off.
Public attributes
|
PROPERTY_NAME_DECELERATION_RATE = "decelerationRate"
|
const string
Property name for accessing deceleration rate.
|
PROPERTY_NAME_INERTIA = "inertia"
|
const string
Property name for accessing inertia.
|
SCROLL_DELTA_MULTIPLIER = 1000.0f
|
const float
Multiplier for calculating the scroll delta.
|
decelerationRate = 0.05f
|
float
The deceleration rate is the speed reduction per second.
|
inertia = true
|
bool
Inertia means that scroll events will continue for a while after the user stops touching the touchpad.
|
Public functions
|
HandleScroll(GameObject currentGameObject, PointerEventData pointerData, GvrBasePointer pointer, IGvrEventExecutor eventExecutor)
|
void
Performs scrolling if the user is touching the controller's touchpad.
|
Public attributes
Public functions
All rights reserved. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-09 UTC.
[null,null,["Last updated 2024-10-09 UTC."],[[["\u003cp\u003eGvrPointerScrollInput manages scroll events in Unity VR applications using GvrPointerInputModule.\u003c/p\u003e\n"],["\u003cp\u003eIt utilizes individual velocities for each IScrollHandler, enabling independent and potentially inertial scrolling behaviors.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can control the scroll deceleration rate and toggle inertia on or off through public attributes.\u003c/p\u003e\n"],["\u003cp\u003eThe HandleScroll function processes touch input to execute scrolling actions based on the user's interaction with the controller's touchpad.\u003c/p\u003e\n"]]],["`GvrPointerScrollInput` routes scroll events via Unity's event system, maintaining velocities for each `IScrollHandler`. It uses `HandleScroll` to perform scrolling based on touchpad input, with speed tied to touch position. Key attributes include `decelerationRate` (default 0.05f) controlling speed reduction, `inertia` (default true) for continued scrolling after touch, and `SCROLL_DELTA_MULTIPLIER` (1000.0f) for adjusting scroll delta. `PROPERTY_NAME_DECELERATION_RATE` and `PROPERTY_NAME_INERTIA` provide access to these properties.\n"],null,["# GvrPointerScrollInput Class Reference\n\nGvrPointerScrollInput\n=====================\n\nThis class is used by [GvrPointerInputModule](/vr/reference/unity/class/GvrPointerInputModule#classGvrPointerInputModule) to route scroll events through Unity's event system.\n\nSummary\n-------\n\nIt maintains indepedent velocities for each instance of `IScrollHandler` that is currently being scrolled. Inertia can optionally be toggled off.\n\n| ### Public attributes ||\n|--------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------|\n| [PROPERTY_NAME_DECELERATION_RATE](#classGvrPointerScrollInput_1a7b0e91b534e89e1fef03d9f517e2b0da)` = \"decelerationRate\"` | `const string` Property name for accessing deceleration rate. |\n| [PROPERTY_NAME_INERTIA](#classGvrPointerScrollInput_1aa71cf453b2443d1a4be3c9ad4032d48c)` = \"inertia\"` | `const string` Property name for accessing inertia. |\n| [SCROLL_DELTA_MULTIPLIER](#classGvrPointerScrollInput_1addbf17c6af3fbf61b35aa4b50f4c5929)` = 1000.0f` | `const float` Multiplier for calculating the scroll delta. |\n| [decelerationRate](#classGvrPointerScrollInput_1a1c8f06c1d9c4fb615d4efa84ed6b0f24)` = 0.05f` | `float` The deceleration rate is the speed reduction per second. |\n| [inertia](#classGvrPointerScrollInput_1a4ef95526dcdbcfe59115dd0b19159c05)` = true` | `bool` Inertia means that scroll events will continue for a while after the user stops touching the touchpad. |\n\n| ### Public functions ||\n|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------|\n| [HandleScroll](#classGvrPointerScrollInput_1a961579640d37a528ddd765f7b83425b6)`(GameObject currentGameObject, PointerEventData pointerData, `[GvrBasePointer](/vr/reference/unity/class/GvrBasePointer#classGvrBasePointer)` pointer, `[IGvrEventExecutor](/vr/reference/unity/interface/IGvrEventExecutor#interfaceIGvrEventExecutor)` eventExecutor)` | `void` Performs scrolling if the user is touching the controller's touchpad. |\n\nPublic attributes\n-----------------\n\n### PROPERTY_NAME_DECELERATION_RATE\n\n```c#\nconst string PROPERTY_NAME_DECELERATION_RATE = \"decelerationRate\"\n``` \nProperty name for accessing deceleration rate. \n\n### PROPERTY_NAME_INERTIA\n\n```c#\nconst string PROPERTY_NAME_INERTIA = \"inertia\"\n``` \nProperty name for accessing inertia. \n\n### SCROLL_DELTA_MULTIPLIER\n\n```c#\nconst float SCROLL_DELTA_MULTIPLIER = 1000.0f\n``` \nMultiplier for calculating the scroll delta.\n\nUsed so that the scroll delta is within the order of magnitude that the UI system expects. \n\n### decelerationRate\n\n```c#\nfloat decelerationRate = 0.05f\n``` \nThe deceleration rate is the speed reduction per second.\n\nA value of 0.5 halves the speed each second. The default is 0.05. The deceleration rate is only used when `inertia` is `true`. \n\n### inertia\n\n```c#\nbool inertia = true\n``` \nInertia means that scroll events will continue for a while after the user stops touching the touchpad.\n\nIt gradually slows down according to the `decelerationRate`.\n\nPublic functions\n----------------\n\n### HandleScroll\n\n```c#\nvoid HandleScroll(\n GameObject currentGameObject,\n PointerEventData pointerData,\n GvrBasePointer pointer,\n IGvrEventExecutor eventExecutor\n)\n``` \nPerforms scrolling if the user is touching the controller's touchpad.\n\nScroll speed is dependent upon touch position.\n\n\u003cbr /\u003e\n\n| Details ||\n|------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Parameters | |---------------------|--------------------------------------------------------| | `currentGameObject` | The game object having the `IScrollHandler` component. | | `pointerData` | The pointer event data. | | `pointer` | The pointer object. | | `eventExecutor` | The executor to use to process the event. | |"]]