unity3d - How to draw multiple 3d object on unity? -
i want draw 3d circle , 3d cube @ center of circle on unity3d. create 6 faces of cube below code :
mesh.vertices = new vector3[]{ // face 1 (xy plane, z=0) new vector3(0,0,0), new vector3(1,0,0), new vector3(1,1,0), new vector3(0,1,0), // face 2 (zy plane, x=1) new vector3(1,0,0), new vector3(1,0,1), new vector3(1,1,1), new vector3(1,1,0), // face 3 (xy plane, z=1) new vector3(1,0,1), new vector3(0,0,1), new vector3(0,1,1), new vector3(1,1,1), // face 4 (zy plane, x=0) new vector3(0,0,1), new vector3(0,0,0), new vector3(0,1,0), new vector3(0,1,1), // face 5 (zx plane, y=1) new vector3(0,1,0), new vector3(1,1,0), new vector3(1,1,1), new vector3(0,1,1), // face 6 (zx plane, y=0) new vector3(0,0,0), new vector3(0,0,1), new vector3(1,0,1), new vector3(1,0,0), };
i create circle around cube below code :
float x; float y; float z = 0.5f; float angle = 1f; (int = 0; < (segments + 1); i++) { x = 0.5f + mathf.sin (mathf.deg2rad * angle) * xradius; y = 0.5f + mathf.cos (mathf.deg2rad * angle) * yradius; line.setposition (i,new vector3(x,y,z)); angle += (360f / segments); }
i expect upper codes upper task. don't. see cube , circle. cube not cenetr of circle 3d. z position not right me.
my screenshot below :
should use multiple camera work?
ok, answering here because cannot comment yet. rutter said, looks space problem. can make points of linerenderer
operate in local space, uncheck use world space
bool in inspector. let move gameobject
around scene freely.
Comments
Post a Comment