Request an example of rotating/zooming an object by dragging the trackpad of the controller

I’m practicing the features with examples as a non-developer.
The method of rotation when moving the controller in the example is applied. (NRInput.GetRotation():wink:

As another method, I would like to apply the function of left/right (rotate) and up/down (enlarge/reduce) with the track pad of the controller.
Can you share examples or Scripts to which the function can be applied?

Edit: script for scale corrected.

Use NRInput.GetDeltaTouch() in the component’s Update() to get how much your hand slided on the touchpad in that frame.

Vector2 delta_move = NRInput.GetDeltaTouch()

Use delta_move.y to make something bigger/smaller:

float scale_amount = 1.0f; // change this to control scale speed.
// now multiply the localScale by the delta_move.y
Transform.localScale *= 1 + (delta_move.y * scale_amount * Time.deltaTime);

For the rotation, there are multiple ways to do it, but the easiest one would be Transform.Rotate(Vector3 axis, float angle)

For rotation you can use delta_move.x:

float rotate_amount = 360.0f; // we rotate a full circle in 1 second
// We will rotate around the Y axis, which is also the Up vector
Transform.Rotate(Vector3.up, delta_move.x * rotate_amount * Time.deltaTime);

Hope this helps :wink: good luck


thank you~^^
We will refer to the code you shared and re-share it after testing.
Thank you so much again.

1 Like