Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Update()
- {
- // TOP LEFT
- Collider[] topLeftColliders = Physics.OverlapSphere(topLeft.position, radius);
- // Loop through the colliders to perform actions with them
- foreach (Collider collider in topLeftColliders)
- {
- // Do something with the collider (e.g., access its GameObject, apply forces, etc.)
- GameObject otherObject = collider.gameObject;
- GameObject parentOtherObject = otherObject.transform.root.gameObject;
- Debug.Log("carrot1");
- if (otherObject.tag == "TopRightSnapPoint")
- {
- Debug.Log("hello1");
- renderer = GetComponent<MeshRenderer>();
- size = renderer.bounds.size;
- size = new Vector3(size.x, 0, 0);
- Debug.Log(size);
- Debug.Log(topLeft);
- GameObject parentTopLeft = topLeft.transform.root.gameObject;
- parentTopLeft.transform.position = parentOtherObject.transform.position - size;
- parentTopLeft.transform.rotation = parentOtherObject.transform.rotation;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment