math - Unity detecting GameObjects behind Camera -
i have map gameobject, has 8x8 childs, set in rows , columns. hero can go circular on edges, ie [0,0] [8,0]. part works good, can't see going on edge, i've set script, copy tiles behind camera sight of camera.
for (int = 0; < transform.childcount; i++) { transform child = transform.getchild(i); if (child.position.z < camera.current.transform.position.z) { vector3 offset = new vector3(0,0,8); child.transform.position += offset; } }
the problem this, camera uses follow script on hero, has rotation well. how edit script above move childs out of camera sight, , move them correct offset dependant on direction? on following image, i'd move tiles red mark green mark. it's 16 16, because looks better :)
use renderer.isvisible
method on these tiles renderers.
Comments
Post a Comment