Log in or register to post comments

Accessing trackable variable in JS

July 27, 2011 - 12:44am #1

How do I access trackable in JS? In CS I would do this:

public TrackableBehaviour m_Trackable1;
if(m_Trackable1.CurrentStatus == TrackableBehaviour.Status.DETECTED)
  position = m_Trackable1.transform.position;

This works fine, but if I do this in JS:
var m_Trackable1 : TrackableBehaviour ;
I get the error:
"BCE0018: The name 'TrackableBehaviour' does not denote a valid type ('not found'). "

How do I fix this?

Re: Accessing trackable variable in JS

July 28, 2011 - 10:22am #3

Hi Peter,

I read about that. But I want to avoid moving project files around. I did this before with another middleware package and it broke the whole thing. File A must be compiled before file B, so A must be moved into another folder. But file A has to be compiled after file C from another package, and now it is compiled before it, because it has been moved to another folder. It just became a mess. So I am not even going to try it this time. I am in the process of porting my entire project to C# to get around this problem. That should do the trick. I just hope that Unity will some day address this issue. C# and JS are supposed to be compatible in Unity but in my opinion they are not. The whole system is broken and needs to be rethought.

Re: Accessing trackable variable in JS

July 28, 2011 - 10:06am #2

Hello Elecman,

There is a tricky part of Unity causing your error. Scripts in Unity are compiled in passes based on their folder location. Files in the Plugin folder are compiled first. In order for javascript to us C# classes, the C# scripts need to be compiled first. A solution to this is to move the entire Qualcomm Augmented Reality Folder into the Plugins folder. Remember to keep your Javascript files elsewhere outside the plugins folder.

Thank you,


Log in or register to post comments