Log in or register to post comments

Trigger an animation in Unity Augmented Reality with a collision (SDK: Vuforia) and problem with a tutorial

February 1, 2021 - 11:53am #1

Hello Everyone,

I am kind of new to Unity and I am trying to get two bodies to interact with each other via an animation when they're in close proximity.

When these 2 bodies are separated they're supposed to be idle.

One of the bodies has a rigid body and box collider. The other one only a box collider with a trigger.

I used 3 states in my animator, to trigger the animation I used a boolean condition.



This is my script:

Quote:

using System.Collections;

using System.Collections.Generic;

using UnityEngine;



public class Kollision : MonoBehaviour

{



    [SerializeField] private Animator myAnimationController;







    // Start is called before the first frame update

    private void OnTriggerEnter(Collider other)

    {

        if (other.CompareTag("Player"))

        {

            myAnimationController.SetBool("Zusammen", true);

        }

          

    }



    // Update is called once per frame

    void Update()

    {

      

    }

}

 

I can't get the animation to start. Can you please help me?

The version I'm using is Unity 2020.1.11f1

 

My second question is regarding the tutorial from the Vuforia library: How To Dynamically Add Content to Targets in Unity

I think the code is deprecated, I replaced ITrackableEventHandler with DefaultTrackableEventHandler. I had a second mistake that I coulnd't find an answer for

What should I replace mTrackableBehaviour.RegisterTrackableEventHandler(this); with?

 

 

AttachmentSize
Image icon animator.png92.6 KB
Log in or register to post comments