"We offer new support options and therefor the forums are now in read-only mode! Please check out our Support Center for more information." - Vuforia Engine Team

How to rotate an object along all 3 axes with finger swipe?

I'm working on a simple AR Vuforia application. How can I implement the rotation of an object along all three axes with one finger swipe?

The code I'm currently using has one bug: the rotation of the object depends on its local axes. For example, if I look at the object from the front, everything works as it should, but if I look at the object from the back side, the finger swipe upwards makes it rotate downwards and vice versa.

Here is this script:

public float rotSpeed = 30f;

void OnMouseDrag() { float rotX = Input.GetAxis("Mouse X")*rotSpeed*Mathf.Deg2Rad; float rotY = Input.GetAxis("Mouse Y")*rotSpeed*Mathf.Deg2Rad;

transform.Rotate(Vector3.up, -rotX); transform.Rotate(Vector3.right, -rotY); }

But this is not what I need, how can I rotate the object according to the finger swipe direction regardless of the angle from which I look at it?

Hello,

The Vuforia Ground Plane sample app in our Core Samples demonstrates how to use touch events to move augmentations. These are available for free on the Unity Asset Store.

Thanks,

Vuforia Engine Support

isamalhassan

Fri, 04/02/2021 - 21:18

In reply to by medabit

Hi i'm beginner , can you please give more details about this assets and how to do the touch events please? if there will be any videos i will be greatfull. thank you

Hi @isamalhassan,

As mentioned by medabit, in our Core Sample app available on the Unity asset store, there is scene Ground Plane in which we demo exactly this behaviour.

Hello everyone.

This works nice regardless of your object's rotation, and regardless of your camera position relative to the object:

public float rotSpeed = 30f;

Hello, I don't know how to write scripts. I only write scripts. For me, this lotate script is a necessary script. Could you make this script for me? My email is rucciper88@naver.com. I beg you.