I would like to move the “molecule” object to UR_Detector.position += new Vector(0.4,0.4) but the syntax is not logically correct.
Any suggestion?
private void UR_Attach()
{
RaycastHit2D attachCheck = Physics2D.Raycast(UR_Detector.position, Vector2.one * transform.localScale, 0);
if (attachCheck.collider != null && attachCheck.collider.tag == "Molecule")
{
attachCheck.collider.gameObject.transform.parent = UR_Detector;
attachCheck.collider.gameObject.transform.position = UR_Detector.position += new Vector2 (0.4,0.4);
if (Input.GetKey(KeyCode.X))
{
attachCheck.collider.gameObject.transform.parent = null;
}
}
}