Hi everyone in this forum, hope you're having a nice time here.
I'll explain the current issue I'm experiencing in order to create a Reset button for a ground plane screne in Unity with Vuforia. Here's the situation:
I have an UI with different buttons, 3 for placing objects in the current scene ( 3 differents) 2 buttons on the sides in order to rotate the objects (I need to finish this part because has to work in a different way than right now, but I have it working fine). The issue comes with the "Reset" button.
I'll expose the code regarding the reset and some details regarding it:
public class UserInterfaceButtons : MonoBehaviour { public float rotationSpeed = 70.0f; public float translationSpeed = 5.0f; public Transform ObjAffected1; public GameObject ObjAffected2; public GameObject ObjAffected3; public Transform originalPosition; // public GameObjects public Quaternion current; bool repeatRotateLeft = false; bool repeatRotateRight = false; public void Awake() { current = Quaternion.identity; } void Update() { if (repeatRotateRight) { RotationRightButton(); } if (repeatRotateLeft) { RotationLeftButton(); } } public void RotationRightButton() { // transform.Rotate (0, -rotationSpeed * Time.deltaTime, 0); ObjAffected1.transform.Rotate(0, -rotationSpeed * Time.deltaTime, 0); Debug.Log("rotate R"); } public void RotationRightButtonRepeat() { // transform.Rotate (0, -rotationSpeed * Time.deltaTime, 0); repeatRotateRight = true; Debug.Log("rotate R2"); } public void Restart() { Debug.Log("reset"); Quaternion.identity.Set(current.x, current.y, current.z, current.w); /*Quaternion currentRotation = new Quaternion(transform.rotation.x, transform.rotation.y, transform.rotation.z, 0); currentRotation = current;*/ //This is a test string regarding transform.rotation }
What I want to achieve is the reset button, that means reset the object rotation and respecting the location of the following: AR Camera, Ground Plane Stage and also Plane Finder, as this scene will be applied with Ground plane detection. This means that the rotation has to be reseted and the object has to be removed from the scene or at least dissapear from it.
As much as I investigated regarding it, looks like Quaternians are needed in order to do this kind or workflow. I'm not that familiar with them and finding guides regarding it is really complicated, hope you guys can provide me some help in order to keep advancing on my current project.
Thanks for your help and looking forward to hearing from you. Kind regards.
EDIT: I've already solved it. Thanks anyway. Can close the post.
would you mind sharing the
would you mind sharing the solution. Im new at vuforia and unity, been able to load my scene when you open the app, but when running into tracking issues decide to restart the app, it will be more convenient to have a restart app button... or anything in that sort.
Please share the reset button
Please share the reset button solution if possible. It would help greatly. Thank you!
Hello,
Hello,
The Vuforia Engine Core samples on the Unity Asset Store have a reset button associated with the Ground Plane feature to reset the tracker. This is the best reference code resource that is available to you IMO.
Thanks,
Vuforia Engine Support
Hi,
Hi,
Could you tell me where to find this reset button function?
The Ground Plane sample project doesn't exist anymore so I've been looking in the Core Samples and can't find this reset button function.
Maybe it's named differently?
Thanks!
Hello,
Hello,
I looked at the 8.3 Core Samples, available for free on the Unity Asset Store, and see that the "3-GroundPlane" scene still has the reset function.
Please see attached.
Thanks,
Vuforia Engine Support