Hi guys, i had a problem on pre publication time, one think become one of greatest problem i ever meet. I have a game with some mechanism, u can see it on screenshot, the point of a game is stretch rood between two round mechanism. but i cant make it well, it always to far or too close. Very need your help. thx. I do it that way : _ gameobject1 and 2 its two round mechanism. Vector3 mousePos = Input.mousePosition; Vector3 objectPos = Camera.main.WorldToScreenPoint(transform.position); mousePos.x = mousePos.x - objectPos.x; mousePos.y = mousePos.y - objectPos.y; // rotate to right direction float angle = Mathf.Atan2(mousePos.y, mousePos.x) * Mathf.Rad2Deg; transform.rotation = Quaternion.Euler(new Vector3(0, 0, angle)); // stretch stuff var distance = (_gameobjec1.transform.position - _gameobjec2.transform.position).magnitude; GetComponent<RectTransform>().localScale = new Vector2(distance/3f, 1); P.s sorry for my bad english..
Hey! are those values in screen space? if not, you should probably get on screen positions of this objects
in code: create a cube that is at the start. make the cube look at the end Parent the object to that cube. use the Z axis on scale on the cube to stretch your object