hi andeeee, thanks for looking into this… here is what i tried in meanwhile
i decided to use renderer.bounds. i would normally use collider.bounds but some object have box some have mesh colliders, i am not does it matter. and i dont know are the renderer.bounds and collider.bounds the same?
i calculated 8 vertices like this:
//CURRENT TARGET TRANSFORM
var ctt : Transform=ReturnCameraTargetTransform();
//POSITIVE Z
//1,1,1
v1=new Vector3(ctt.renderer.bounds.size.x+ctt.renderer.bounds.extents.x, ctt.renderer.bounds.size.y+ctt.renderer.bounds.extents.y,
ctt.renderer.bounds.size.z+ctt.renderer.bounds.extents.z);
//-1,1,1
v2=new Vector3(ctt.renderer.bounds.size.x-ctt.renderer.bounds.extents.x,
ctt.renderer.bounds.size.y+ctt.renderer.bounds.extents.y,
ctt.renderer.bounds.size.z+ctt.renderer.bounds.extents.z);
//-1,1,1
v3=new Vector3(ctt.renderer.bounds.size.x-ctt.renderer.bounds.extents.x,
ctt.renderer.bounds.size.y-ctt.renderer.bounds.extents.y,
ctt.renderer.bounds.size.z+ctt.renderer.bounds.extents.z);
//1,-1,1
v4=new Vector3(ctt.renderer.bounds.size.x+ctt.renderer.bounds.extents.x,
ctt.renderer.bounds.size.y-ctt.renderer.bounds.extents.y,
ctt.renderer.bounds.size.z+ctt.renderer.bounds.extents.z);
//NEGATIVE Z
//1,1,-1
v5=new Vector3(ctt.renderer.bounds.size.x+ctt.renderer.bounds.extents.x,
ctt.renderer.bounds.size.y+ctt.renderer.bounds.extents.y,
ctt.renderer.bounds.size.z-ctt.renderer.bounds.extents.z);
//-1,1,-1
v6=new Vector3(ctt.renderer.bounds.size.x-ctt.renderer.bounds.extents.x,
ctt.renderer.bounds.size.y+ctt.renderer.bounds.extents.y,
ctt.renderer.bounds.size.z-ctt.renderer.bounds.extents.z);
//-1,-1,-1
v7=new Vector3(ctt.renderer.bounds.size.x-ctt.renderer.bounds.extents.x,
ctt.renderer.bounds.size.y-ctt.renderer.bounds.extents.y,
ctt.renderer.bounds.size.z-ctt.renderer.bounds.extents.z);
//1,-1,-1
v8=new Vector3(ctt.renderer.bounds.size.x+ctt.renderer.bounds.extents.x,
ctt.renderer.bounds.size.y-ctt.renderer.bounds.extents.y,
ctt.renderer.bounds.size.z-ctt.renderer.bounds.extents.z);
then i rendered lines in this sequence v1-v2.v2-v3.v3-v4.v4-v1,v5-v6.v6-v7.v7-v8,v8-v1
this does not render the whole cube, it renderes only front and back rect. but it does not render it
where it should. i thought that problem lies in world and local space so i did this:
v1=transform.TransformPoint(v1);
v2=transform.TransformPoint(v2);
v3=transform.TransformPoint(v3);
v4=transform.TransformPoint(v4);
v5=transform.TransformPoint(v5);
v6=transform.TransformPoint(v6);
v7=transform.TransformPoint(v7);
v8=transform.TransformPoint(v8);
it didnt fix the problem, it renders the lines but again somewhere different than around the selected object.
so what is your opinion, where the problem is?