Page 1 of 1

Getting a unique identifier when a touch is registered

Posted: 11 Nov 2015, 18:23
by Luke47921
In my project, I'm trying to create a script that will be called when a button is touched, and will return the co-ordinates of an axis attached to said button (which has been exposed to the scene data), and then move to that point. I plan for the script to output, using the scene data, the value of the X, Y, and Z axis values of the button touched, based on the ID of the node touched, something like this:

Code: Select all

	
public bool OnReturnNodeValues(int arg)
	{
		NodeID = //get the id of the node touched here
		string[] address = new string[] {NodeID + "/X", NodeID + "/Y", NodeID + "/Z"};
		object[] XYZ = new object[]{null};
			
		GetNodeValues(address, XYZ);
		
		//set output values using object XYZ

		return false;
	}
	
	public void GetNodeValues(string[] Address, object[] Values)
	{
		IScriptScene scene = this.Scene;
		scene.Get(Address, out Values);
	}	
Let's say one node is called 'One'. If I touch 'One', I'd like the NodeID to be set to 'One', and then I can get the X, Y and Z values from scene data, and feed them into another node in my scene.

However, I'm not sure how i would get the 'NodeID' for a node from a touch, and I'd like to know how.