public void ConnectForceSensor(ForceSensor fs)//Pre-initialize { forceSensor = fs; forceSensorLock = new Joint(); switch (fs.sensorPosition) { case 0: { fs.position = position; fs.position.y = position.y - size.y - fs.size.y / 2 - 0.001; //bot position forceLockPosition = fs.position; forceLockPosition.y = fs.position.y + fs.size.y / 2 + 0.0005; //position of the point where they are locked together. break; // } case 1: { fs.position = position; fs.position.x = position.x - size.x - fs.size.x / 2 - 0.001; //left position forceLockPosition = fs.position; forceLockPosition.x = fs.position.x + fs.size.x / 2 + 0.0005; //position of the point where they are locked together. break; } case 2: { fs.position = position; fs.position.y = position.y + size.y + fs.size.y / 2 + 0.001; //top position forceLockPosition = fs.position; forceLockPosition.y = fs.position.y - fs.size.y / 2 - 0.0005; //position of the point where they are locked together. break; } case 3: { fs.position = position; fs.position.x = position.x + size.x + fs.size.x / 2 + 0.001; //right position forceLockPosition = fs.position; forceLockPosition.x = fs.position.x - fs.size.x / 2 - 0.0005; //position of the point where they are locked together. break; } } }
/*-------------------------------------------------Force Sensors:-------------------------------------------------*/ public void Create_ForceSensorLock(SensorModule sm, ForceSensor fs, Vector3 lockPosition) { agxJoint = new AgX_Joint(guid); agxJoint.ForceSensorLock(sm.agxPrimitive, fs.agxSensor, lockPosition); agxJoint.AddtoAssembly(); }