Log in or register to post comments

Incorrect scale set by ImageTarget

June 15, 2015 - 6:14am #1

Vuforia SDK Version: vuforia-unity-mobile-android-ios-4-0-105.unitypackage -

Description with steps to reproduce:

Sir i'm using make assetbundle of table. After i download it and i follow instruction on here 
https://developer.vuforia.com/forum/faq/unity-how-can-i-augment-my-image-target-model

The tutorial is work but my gameObject become so small not same like i'm scaling on Unity (before i build as a assetbundle), and at the start the game object is appear on my screen before i track my camera to marker
What should i do?

-

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

Mobile OS and Version: Android API 9 -

Mobile Device Manufacturer and Model name: Android -

Do the Vuforia Sample Applications show the same behavior?: yes, but the gameObject so small, and at the start the game object is appear on my screen before i track my camera to marker

Incorrect scale set by ImageTarget

June 24, 2015 - 7:54pm #4

I would suggest putting some Debug.Log() commands in your code so that you know what's happening in each method and when they're called. You can also set breakpoints in MonoDevelop and step through your code.

https://unity3d.com/learn/tutorials/modules/beginner/scripting/monodevelops-debugger

 

Incorrect scale set by ImageTarget

June 19, 2015 - 7:53pm #3

I'm trying augmented from the asset bundle i have uploaded before, that's why i'm hiding the original augmentation.
Because i want the uploaded(cloned) object to my detected marker.

This is my code but still not working looks like OnTrackableStateChanged is not called :(
Please help

using UnityEngine;
using System.Collections;
using Vuforia;

public class MainMenus : MonoBehaviour, ITrackableEventHandler {
float sWidth, sRatio;
Vector3 sfGUI;

public string bundleURL;
public string AssetName;
public int Version;
GameObject mBundleInstance = null;
TrackableBehaviour mTrackableBehaviour;
bool mAttached = false;

void Start() {

StartCoroutine (DownloadAndCache());

mTrackableBehaviour = GetComponent<TrackableBehaviour>();
if (mTrackableBehaviour) {
mTrackableBehaviour.RegisterTrackableEventHandler(this);
}

}

// Update is called once per frame
IEnumerator DownloadAndCache() {
while (!Caching.ready)
yield return null;
// example URL of file on PC filesystem (Windows)
// string bundleURL = "file:///D:/Unity/AssetBundles/MyAssetBundle.unity3d";
// example URL of file on Android device SD-card
using (WWW www = WWW .LoadFromCacheOrDownload(bundleURL, Version)) {
yield return www;
if (www .error != null)
throw new UnityException ("WWW Download had an error: " + www .error);
AssetBundle bundle = www .assetBundle;
if (AssetName == "") {
mBundleInstance = Instantiate (bundle.mainAsset) as GameObject;

} else {
mBundleInstance = Instantiate (bundle.LoadAsset (AssetName)) as GameObject;

}
}
}

public void OnTrackableStateChanged(
TrackableBehaviour.Status previousStatus,
TrackableBehaviour.Status newStatus) {
if (newStatus == TrackableBehaviour.Status.DETECTED ||
    newStatus == TrackableBehaviour.Status.TRACKED ||
    newStatus == TrackableBehaviour.Status.EXTENDED_TRACKED) { 
//||
//newStatus == TrackableBehaviour.Status.EXTENDED_TRACKED) {

if (mBundleInstance) {
// if bundle has been loaded, let's attach it to this trackable
mBundleInstance.transform.parent = mTrackableBehaviour.transform;
mBundleInstance.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f);
mBundleInstance.transform.localPosition = new Vector3(0.0f, 0.0f, 0.0f);
mBundleInstance.transform.gameObject.SetActive(true);
mAttached = true;
}
}
}

void Awake(){
sWidth = Screen.width;
sRatio = sWidth / 1920;
sfGUI = new Vector3 (sRatio, sRatio, 1);

}

void OnGUI(){
// left top button1 
GUI.matrix = Matrix4x4.TRS(new Vector3(sfGUI.x,sfGUI.y,0), Quaternion.identity, sfGUI);
if (GUI.Button (new Rect (20, 20, 200, 50), "Exit")) {
Application.Quit();
}

// left top button2 
GUI.matrix = Matrix4x4.TRS(new Vector3(sfGUI.x,sfGUI.y,0), Quaternion.identity, sfGUI);
if (GUI.Button (new Rect (20, 80, 200, 50), "Get Marker")) {
Application.OpenURL("http://3obj.host22.com/marker/");
}
} 

// Update is called once per frame
void Update () {

}
} 

 

 

Incorrect scale set by ImageTarget

June 18, 2015 - 4:13pm #2

From your screenshot, looks like augmentation is cloned what is displayed is not parented to ImageTarget. The augmentation under ImageTarget appears disabled. Try unhiding the original augmentation and see if it appears correctly.

Log in or register to post comments