void Update()
{
Vector3 pos = stream.getRigidBodyPosData (label);
// pos = new Vector3 (Mathf.Sin (t), 1f + Mathf.Cos (t), -1f);
// t += Time.deltaTime;
Quaternion rot = stream.getRigidBodyRotData (label);
this.transform.localPosition = pos;
this.transform.localRotation = rot;
if (pos == Vector3.zero) {
brush.transform.localPosition = lastPos;
brush.transform.localRotation = lastRot;
} else {
brush.transform.localPosition = pos;
lastPos = pos;
brush.transform.localRotation = rot;
lastRot = rot;
}
int button_bits = stream.getButtonStatus (label);
if ((button_bits&A)>0) {
if (!drawing) {
lineFactory.onClick();
drawing = true;
}
} else {
if (drawing) {
lineFactory.onRelease();
drawing = false;
}
}
if ((button_bits&B)>0) {
if (!erasing) {
lineFactory.onRightClick();
erasing = true;
}
} else {
if (erasing) {
lineFactory.onRelease();
erasing = false;
}
}
}