Log in or register to post comments

Unified Target Coordinates

May 23, 2013 - 5:25am #1

 

Hello;

 

Using Xcode (and based on "Unified Target Coordinates") y was able to use an ImageTarget as my "world base" and several frame markers which are placed above it; to get its placement informarion respect the "world base":

 

In this image is explained better:

http://farm9.staticflickr.com/8391/8464126177_a2fe8cba66.jpg

 

As I said I did it using Xcode:

https://developer.vuforia.com/forum/rendering-opengl-es/unified-target-coordinates-modification

 

 

I'm trying to do the same using Unity; but I don't know how to get it works or whether is possible or not.
 
Can anyone help me, please?
 
 
 
Thanks!

 

 

Unified Target Coordinates

June 13, 2013 - 6:05pm #9

I have send you an email as well.

Unified Target Coordinates

June 12, 2013 - 6:00pm #8

Pls see my PM

Unified Target Coordinates

June 12, 2013 - 3:17am #7

I've trying to draw the local axis on each target to see what happens; using Unity components only it works perfectly as I told you, but with Vuforia elements, these axes behave not as expected... (World center mode to none, doesn't solve this problem)

 

Drawing axes code:

//FrameMarker Axis
		Vector3 ejeZnegFM = Vector3.Scale(imageTarget2.transform.forward, new Vector3(1,1,-1));
		Vector3 ejeXnegFM = Vector3.Scale(imageTarget2.transform.right, new Vector3(-1,1,1));
		Debug.DrawLine(imageTarget2.transform.position,imageTarget2.transform.forward*75,Color.green);
		Debug.DrawLine(imageTarget2.transform.position,ejeZnegFM*75,Color.yellow);
		Debug.DrawLine(imageTarget2.transform.position,imageTarget2.transform.right*100,Color.green);
		Debug.DrawLine(imageTarget2.transform.position,ejeXnegFM*100,Color.yellow);
		
		
		//ImageTarget Axis
		Vector3 ejeZnegIT = Vector3.Scale(imageTarget.transform.forward, new Vector3(1,1,-1));
		Vector3 ejeXnegIT = Vector3.Scale(imageTarget.transform.right, new Vector3(-1,1,1));
		Debug.DrawLine(imageTarget.transform.position,imageTarget.transform.forward*75,Color.green);
		Debug.DrawLine(imageTarget.transform.position,ejeZnegIT*75,Color.yellow);
		Debug.DrawLine(imageTarget.transform.position,imageTarget.transform.right*100,Color.green);
		Debug.DrawLine(imageTarget.transform.position,ejeXnegIT*100,Color.yellow);

 

Can anyone give any answer!?

 

 

PD: I also attach some screenshot for you to see what happens

 

Unified Target Coordinates

June 10, 2013 - 5:47am #6

Hello,

 
As AlessndroB told me, I've tried to do it using the Transform class. I didn't use the Vuforia plugin, just using Unity. As I supposed, it was quite easy to implement. In the image you can see the result:
 
 
This is the desired behavior; I'm able to get the sphere relative position and angle respect the plane, BUT when I use the script with the Vuforia objects I doesn't behave this way (to be honest I can't understand their behavior…) This is the code used without using the Vuforia plugin:
 
var plane : Transform;
var sphere : Transform;
private var projectedPoint:Vector3;
private var localPosX:float;
private var localPosZ:float;
private var angle:float;

private var shipPlane:Plane;

function Start () {
	shipPlane = new Plane(Vector3.up, Vector3.zero);
}

function Update ()
{
	var planeNormal:Vector3 = plane.up;
	var vectorToProject:Vector3 = sphere.position;
	
	projectedPoint = vectorToProject - Vector3.Dot(vectorToProject, planeNormal) * planeNormal;
	
	angle = Vector3.Angle(plane.forward, sphere.forward);
	
	Debug.Log(angle);
	Debug.DrawLine(plane.position, projectedPoint, Color.red);
	Debug.DrawLine(plane.position, plane.forward*2+plane.position, Color.green);
	Debug.DrawLine(plane.position, plane.right*2+plane.position, Color.green);
	
	localPosX = projectedPoint.x-plane.position.x;
	localPosZ = projectedPoint.z-plane.position.z;
	
	
}	


function OnGUI()
{
		GUI.Box (new Rect (0,0,250,40), "Position: ("+localPosX+","+localPosZ+")\nAngle: "+angle);

 
I've also used the Raycast & RaycastHit classes to cast a ray from the FrameMarker against the ImageTarget (with its collider) and then place (move) the sphere, whose parent is the ImageTarget, in the impact point; but the movement isn't smooth. What I mean to say is that the movement seems to be discrete (non continuous)…
 
//(...)OnTrackablesUpdate
if (Physics.Raycast(trackableSat.transform.position, -Vector3.up, out hit)&&hit.collider.name=="ImageTarget")
		{
			if(hit.transform.name=="ImageTarget")
			{				
			sphere.transform.position = hit.point;
	      	}
			
		}
I don't know what more could I be doing or even if it is possible to do this using Unity or not. Is it possible only with Xcode?
 
(I PM'ed Elecman but I get no answer.)
 
 
 
Thanks

 

Unified Target Coordinates

May 27, 2013 - 10:37am #5

Try PM'ing elecman, he has developed the UCS.

Unified Target Coordinates

May 27, 2013 - 12:36am #4

could anyone give a tip, please?

Unified Target Coordinates

May 24, 2013 - 5:28am #3

Hi,

I'm trying to do this using Unity, but I don´t understand how to implement it. I suppose that I should set the ImageTarget as the World Center and the track the x/z position of the marker... but it doesn't work... Any guidance?

I need help! :'(

Unified Target Coordinates

May 23, 2013 - 7:46am #2

Hi, it should be perfectly possible to do the same with Unity, the easiest is to check some Unity tutorials on how to use Transform class in Unity:

http://docs.unity3d.com/Documentation/ScriptReference/Transform.html

also, some developers have implemented and shared something similar, called Unified Coordinate System, check this thread:

https://developer.vuforia.com/forum/unity-3-extension-technical-discussion/ucs

 

Log in or register to post comments