private void insertTouchID(GameObject go, DateTime dt) { TouchProperties auxTouchProperties = go.GetComponent <TouchProperties>(); float hardness = 0; float moisture = 0; float roughness = 0; float pressure = 0; float temperature = 0; if (auxTouchProperties != null) { hardness = auxTouchProperties.getHardness(); moisture = auxTouchProperties.getMoistness(); roughness = auxTouchProperties.getRoughness(); pressure = auxTouchProperties.getPressure(); temperature = auxTouchProperties.getTemperature(); } RobotTouch rTouch = new RobotTouch( dt, // the event occurs now uIDD.getID(go), // object definition hardness, // hardness level moisture, // moisture level pressure, // pressure level roughness, // roughness level temperature); // temperature level try // Try to access a resource. { rTouch.insert(); // using dotNetRDF library inserts the information in the triple store } catch (Exception e) { Debug.Log("System>>> " + e.Message); // change for your: LogError(e); // Call a custom error logging procedure. } }
public string getStringTouchInformation() { string str = ""; foreach (GameObject obj in touchInTouch) { str += SEPARATOR; str += "\nPosition: " + obj.transform.position; TouchProperties auxTouchProperties = obj.GetComponent <TouchProperties>(); if (auxTouchProperties != null) { str += "\n" + auxTouchProperties.getTouchStatus(); } else { str += "\nTemperature: " + Constants.ROOM_TEMPERATURE + " ºC"; str += "\nPressure: " + 0; str += "\nPressure: " + 0; str += "\nRoughness: " + 0; str += "\nMoistness: " + 0; str += "\nHardness: " + 0; } str += "\n"; } foreach (GameObject obj in knowObjInTouch) { str += SEPARATOR; str += "\nID: " + uIDD.getID(obj); TouchProperties auxTouchProperties = obj.GetComponent <TouchProperties>(); if (auxTouchProperties != null) { str += "\n" + auxTouchProperties.getTouchStatus(); } else { str += "\nTemperature: " + Constants.ROOM_TEMPERATURE + " ºC"; str += "\nPressure: " + 0; str += "\nPressure: " + 0; str += "\nRoughness: " + 0; str += "\nMoistness: " + 0; str += "\nHardness: " + 0; } str += "\n"; } return(str); }
public bool drop(Vector3 position) { if (!isHandFree()) { objInHand.parent = null; objInHand.position = new Vector3(position.x, objInHand.position.y, position.z); Rigidbody auxRigidbody = objInHand.GetComponent <Rigidbody>(); if (auxRigidbody != null) { auxRigidbody.isKinematic = false; } TouchProperties tP = objInHand.GetComponent <TouchProperties>(); if (tP != null) { tP.exertPressure(false); } objInHand = null; return(true); } return(false); }
public bool hold(Transform obj) { if (isHandFree()) { obj.parent = hand; Rigidbody auxRigidbody = obj.GetComponent <Rigidbody>(); if (auxRigidbody != null) { auxRigidbody.isKinematic = true; } obj.position = refPosGrabObj.position;//new Vector3(refPosGrabObj.position.x,obj.position.y, refPosGrabObj.position.z); TouchProperties tP = obj.GetComponent <TouchProperties>(); if (tP != null) { tP.exertPressure(true); } objInHand = obj; return(true); } return(false); }
Touch buildTouch(Tuio2DCursor cursor) { TouchProperties prop=new TouchProperties(); prop.Acceleration = cursor.Acceleration; prop.VelocityX = cursor.VelocityX; prop.VelocityY = cursor.VelocityY; PointF p = getTouchPoint(cursor); Touch t = new Touch(cursor.SessionID, p); t.Properties = prop; return t; }
private string buildPropertiesString(GameObject gO) { string sensesProperty = ""; string especificProperty = ""; string emotionProperty = ""; SmellProperties auxSmellProperties = gO.GetComponent <SmellProperties>(); if (auxSmellProperties != null) { sensesProperty += auxSmellProperties.getSmellStatus(); } TasteProperties auxTasteProperties = gO.GetComponent <TasteProperties>(); if (auxTasteProperties != null) { sensesProperty += "\n" + auxTasteProperties.getTasteStatus(); } HearingProperties auxHearingProperties = gO.GetComponent <HearingProperties>(); if (auxHearingProperties != null) { sensesProperty += "\n" + auxHearingProperties.getHearingStatus(); } TouchProperties auxTouchProperties = gO.GetComponent <TouchProperties>(); if (auxTouchProperties != null) { sensesProperty += "\n" + auxTouchProperties.getTouchStatus(); } VisionProperties auxVisionProperties = gO.GetComponent <VisionProperties>(); if (auxVisionProperties != null) { sensesProperty += "\n" + auxVisionProperties.getVisionStatus(); } EmotionStatus auxEmotionStatus = gO.GetComponent <EmotionStatus>(); if (auxEmotionStatus != null) { emotionProperty = auxEmotionStatus.getEmotion().ToString(); } Status auxStatus = gO.GetComponent <Status>(); if (auxStatus != null) { especificProperty = auxStatus.getStringStatus(); } string auxText = "ID: " + gO.GetInstanceID() + "\n" + gO.tag + ": " + gO.name + "\nPosition: " + gO.transform.position; if (!sensesProperty.Equals("None")) { auxText += "\n" + sensesProperty; } if (emotionProperty.Equals("")) { emotionProperty = "None"; } if (especificProperty.Equals("")) { especificProperty = "None"; } auxText += "\nStatus: " + especificProperty; auxText += "\nEmotion: " + emotionProperty; return(auxText); }