c# - Unity5 Plane pivot point creating -
i created 50x50 planes c# script. used vertices, uv , triangles. , planes making area. no problem there. plane_0_0 first 1 positioning @ center. need each plane pivoting bottom-left. how can pivoting bottom-left script?
okay, think i've got it. want bottom-left corner "tile" center of whole "tileset" / "map", if , when rotate "everything", should center.
okay, it's easy. need is, make plane_0_0 tile parent of rest of tiles (set .parent
property of tiles want part of pivoting "pivot tile" go).
later on, can change this. if e.g. other tile should pivot center, can "reset parenting". reparenting expensive routine.
edit
as (like wrote above) reparenting expensive operation, thinking alternatives , found use: create gameobject
(let's plane) without mesh renderer, collider, etc , pull out size of field (in editor). make parent of tiles in scene. then, whenever need 'pivot' everything, can go parent-plane's rotatearound, marking rotation center whereever wish (e.g. "above" bottom-left corner tile).
modify standard unity plane
, remove mesh collider
, replace simple box collider
, save prefab , use prefab tile save computing time (if planes' job nothing else serve plateau).
Comments
Post a Comment