Log in or register to post comments

Forum Code Block not loading properly

March 11, 2019 - 12:58am #1

Vuforia SDK Version: - -

Description with steps to reproduce: 1. go to https://developer.vuforia.com/forum/unity-extension-technical-discussion/imagetargetbehaviour-change-just-image-target-not-dataset-help-please
2. go to comment #4 (https://developer.vuforia.com/forum/unity-extension-technical-discussion/imagetargetbehaviour-change-just-image-target-not-dataset-help-please#comment-29957)
3. The Code Block is loaded unreadable and ugly. -

Development OS (Mac OS X, Windows, Linux): - -

Mobile OS and Version: - -

Mobile Device Manufacturer and Model name: - -

Do the Vuforia Sample Applications show the same behavior?:

Forum Code Block not loading properly

March 11, 2019 - 12:42pm #2

Hello,

Thanks for the report. I've opened a ticket for the operations team to resolve.

Here is the code snipped posted here: https://developer.vuforia.com/forum/unity-extension-technical-discussion/imagetargetbehaviour-change-just-image-target-not-dataset-help-please#comment-29957

Apologies for the poor formatting.

Thanks,

Vuforia Engine Support

==========================================================================================================

using UnityEngine;

using System.Collections;

using System.Collections.Generic;

public class DynamicTargets : MonoBehaviour {



private bool mChipsObjectCreated = false;





// Update is called once per frame

void Update ()

{

  IEnumerable<TrackableBehaviour> trackableBehaviours = TrackerManager.Instance.GetStateManager().GetActiveTrackableBehaviours();



  // Loop over all TrackableBehaviours.

  foreach (TrackableBehaviour trackableBehaviour in trackableBehaviours)

  {

   string name = trackableBehaviour.TrackableName;

   Debug.Log ("Trackable name: " + name);

  

   if (name.Equals("chips") && !mChipsObjectCreated)

   {

    // chips target detected for the first time

    // augmentation object has not yet been created for this target

    // let's create it

    GameObject cube = GameObject.CreatePrimitive(PrimitiveType.Cube);

    // attach cube under target

    cube.transform.parent = trackableBehaviour.transform;

   

    // Add a Trackable event handler to the Trackable.

                // This Behaviour handles Trackable lost/found callbacks.

                trackableBehaviour.gameObject.AddComponent<DefaultTrackableEventHandler>();

   

    // set local transformation (i.e. relative to the parent target)

    cube.transform.localPosition = new Vector3(0,0.2f,0);

    cube.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f);

    cube.transform.localRotation = Quaternion.identity;

    cube.gameObject.SetActive(true);

   

    mChipsObjectCreated = true;

   }

  }

}

}

Log in or register to post comments