Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Raynoko · Jul 07, 2014 at 11:42 AM · gameobjectcube3dsmaxcurvemaking

Make curve of cube?

Hi everyone, i dont know how it say.. but i need to make curving cube at run-time. Is it possible? I cant use blender, Creo, 3DsMax or something like that. I have to do in unity at run-Time.. I want to do a room, with 4 walls.. but last wall will be curving or edge radius. Like this -> " ) ". Can u help me with this horrible problem?

Thanks Kind regards Thomas

Comment
Add comment · Show 4
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image meat5000 ♦ · Jul 07, 2014 at 11:39 AM 0
Share

You could use Blender for it, using Shape$$anonymous$$eys (BlendShapes). Aside from that you would have to manipulate the $$anonymous$$esh data. $$anonymous$$egaFiers did things like this I believe.

avatar image Raynoko · Jul 07, 2014 at 12:57 PM 0
Share

Thnaks, but i cant use bleder... i have to do only in unity editor... at run-time.. do you have any idea how to do it?

avatar image Raynoko · Jul 07, 2014 at 04:00 PM -1
Share

Doesnt exist some modul or script with this function? i mean, i have high polygone cube... and i cant to do by creating polygones from script... simple like thisalt text

screenshot_2_2.jpg (49.3 kB)
avatar image meat5000 ♦ · Jul 07, 2014 at 04:01 PM 0
Share

I suggest you include any attempts you have made for yourself.

3 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Andres-Fernandez · Jul 07, 2014 at 12:03 PM

You have to create the mesh at runtime. Check here for the details. You'll have to do some math to get the curved wall. It'll probably take some time, but it's possible.

Comment
Add comment · Show 5 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Raynoko · Jul 07, 2014 at 01:03 PM 0
Share

Thanks, i saw this website.. but i dont know how to start with it... Can u write me more? i mean... need i a cube from unity, or other cube from any 3D model, or nothing? and create a cube from script? thnaks.. again

avatar image Lo0NuhtiK · Jul 07, 2014 at 01:32 PM 0
Share

https://www.google.com/search?q=unity3d+generate+mesh

http://answers.unity3d.com/questions/8023/creating-a-mesh-procedurally.html

http://games.deozaan.com/unity/$$anonymous$$eshTutorial.pdf

avatar image Andres-Fernandez · Jul 08, 2014 at 06:50 AM 0
Share

Read the docs and check the links we posted. The steps you need to follow are:

  1. Create the GameOBject (if needed).

  2. Add a $$anonymous$$eshFilter component.

  3. Create a new $$anonymous$$esh.

  4. Create an array of vertices positions.

  5. Create an array of triangle indexes.

  6. Create an array of UVs (if needed).

  7. Apply the arrays to the mesh.

  8. Calculate the normals of the mesh.

  9. Set the mesh to the meshFilter component.

Here you have some examples. Then, apply material, color, texture or whatever.

avatar image Raynoko · Jul 08, 2014 at 07:11 AM 0
Share

Thank you very much :) sorry for my stupidity... but im newbie in unity, and this is my first complicate problem.

avatar image Andres-Fernandez · Jul 08, 2014 at 12:35 PM 1
Share

It's not being stupid, it's just being new to something. Start with the small examples.

avatar image
0

Answer by Raynoko · Jul 08, 2014 at 10:23 AM

i have this source code ...

 public var mat : Material;
 public var vert : Vector3[];
 public var tris : int[];
 var normals: Vector3[];
 var uv: Vector2[];
 
 function Start(){
     
         vert = new Vector3[5];
         tris = new int[6];
         
         tris [0] = 0;    tris [3] = 3;     
         tris [1] = 2;    tris [4] = 2;    
         tris [2] = 1;    tris [5] = 4;    
 
         
         normals = new Vector3[5];
     
         normals[0] = -Vector3.forward;
         normals[1] = -Vector3.forward;
         normals[2] = -Vector3.forward;
         normals[3] = -Vector3.forward;
         normals[4] = -Vector3.forward;
         
         
         uv = new Vector2[5];
 
         uv[0] = new Vector2(0, 0);
         uv[1] = new Vector2(1, 0);
         uv[2] = new Vector2(1, 1);
         uv[3] = new Vector2(0, 0);
         uv[4] = new Vector2(1, 0);
 
 }
 
 function Update(){
 
         vert [0] = new Vector3 (transform.GetChild(0).gameObject.transform.position.x, 
                                 transform.GetChild(0).gameObject.transform.position.y, 
                                 transform.GetChild(0).gameObject.transform.position.z);
                                 
         vert [1] = new Vector3 (transform.GetChild(1).gameObject.transform.position.x, 
                                 transform.GetChild(1).gameObject.transform.position.y, 
                                 transform.GetChild(1).gameObject.transform.position.z);
         
         vert [2] = new Vector3 (transform.GetChild(2).gameObject.transform.position.x, 
                                 transform.GetChild(2).gameObject.transform.position.y, 
                                 transform.GetChild(2).gameObject.transform.position.z);
         
         vert [3] = new Vector3 (transform.GetChild(3).gameObject.transform.position.x, 
                                 transform.GetChild(3).gameObject.transform.position.y, 
                                 transform.GetChild(3).gameObject.transform.position.z);
         
         vert [4] = new Vector3 (transform.GetChild(4).gameObject.transform.position.x, 
                                 transform.GetChild(4).gameObject.transform.position.y, 
                                 transform.GetChild(4).gameObject.transform.position.z);
 
 
         var mesh : Mesh = new Mesh ();
         mesh.vertices = vert;
         mesh.triangles = tris;
         mesh.normals = normals;
         mesh.uv = uv;
 
                 
         if (!GetComponent(MeshFilter)) {
             gameObject.AddComponent(MeshFilter);
         }
         if (!GetComponent(MeshRenderer)) {
             gameObject.AddComponent(MeshRenderer);
         }
         if (!GetComponent(MeshCollider)) {
             gameObject.AddComponent(MeshCollider);
         }
             gameObject.GetComponent(MeshFilter).mesh = mesh;
             gameObject.GetComponent(MeshRenderer).material = mat;
 }
 
     

wich i have 5 children, when i move one of them my plane changing, and recalculate size, but i dont know how to do "for" i mean source code, wich it will automatic create this children next to one. and then create plane looks like one plane of cube.

this is screenShot, where are my moveable children... alt text


screenshot_3.png (99.6 kB)
Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Raynoko · Mar 13, 2015 at 01:48 PM 0
Share

$$anonymous$$y problem solved this package

avatar image
0

Answer by musaranya · Jul 08, 2014 at 07:07 AM

what about making the wall using small cubes and then move this cubes to get the curve effect? This way you don't need to edit any mesh so it may be easier...

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Raynoko · Jul 08, 2014 at 09:22 AM 0
Share

i was thinking about this solution, but i think that its complicate for my later work, i need one cube with engle radius, because i will apply material, color or textures, and i think that textures will be deformed if ill make one cube from a lot of small cubes.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

See colors when inside Cube - Worldbuilding in a gameobject 2 Answers

How do i detect if a certain cube is being touched? 6 Answers

Instantiating Cube Prefabs with scale 3 Answers

Sorting list of Transforms 1 Answer

Is there a way to edit the dimensions of a gameobject such as a cube or a plane? 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges