- Home /
Need to find position of corners,Renderer.bound alternative
What i am doing?
I am making a dialogue box as seen in comic books. Am Successful in that. Now I calculated distance between two objects. Whatever the distance comes I divided it by 3, in order to create 3 smaller clouds(Called Crumbs in code), leading back to the (Text Like in Comics).
My (Text like in Comics) is pivoted and positioned to Top Left Red is actually Happening Now; I want another color to happen.
print(Vector3.Distance(characterspeak.transform.position,lizarD.transform.position));
float distance= Vector3.Distance(characterspeak.transform.position,lizarD.transform.position)/3;
for(int i =1; i<=3; i++){
Vector3 spawnatdistance =(i* distance) * Vector3.Normalize(characterspeak.transform.position - lizarD.transform.position) +lizarD.transform.position ;
print(spawnatdistance + "spawn At Distance");
GameObject maddialogbox = Instantiate (Crumbs, spawnatdistance, Quaternion.identity,GameObject.Find("WorkSpace").transform) as GameObject;
}
Please Help, I need to find out the sides or positions of the objects (Now the distance is calculated from Top Left due to pivot point). I want to calculate the distance from Center Bottom. And Please suggest any solution to make this possible.
NOTE:- Crumb is a gameobject with Image component in it.
I tried to use transform.right & left& all. No success.
Tried to use MeshRenderer component (Bounds) but no use. If Possible Provide codes.
I am Beginner.