x


Return a single face from a cube primitive for manipulation

I want to create a cube primitive and scale and re position a single face of the cube while the opposite side stays stationary.

Im sure i can figure out a way to directly manipulate the vertices of the cube, but I was hoping it would be easier to just perform a local scale and position on the entire face instead of worrying about re-positioning each vertex manually.

more ▼

asked Jul 13 '11 at 03:46 PM

michael 4 gravatar image

michael 4
312 44 52 56

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

I would think that the most easy way would be to modify the vertices.

Take a look at my blog post about creating procedural mesh in Unity - that should get you started:

http://blog.nobel-joergensen.com/2010/12/25/procedural-generated-mesh-in-unity/

more ▼

answered Jul 13 '11 at 04:02 PM

Mortennobel gravatar image

Mortennobel
1.8k 10 15 34

Looks like a nice example. Also, for reference, see the Mesh docs here.

Jul 13 '11 at 04:36 PM Chris D

Ok so I have an array that holds the vertices I want to manipulate, intelliSense isnt showing anything that allow me to perform a local scale on just those vertices. Any ideas?

Jul 13 '11 at 04:51 PM michael 4

There isn't a convenient command for this kind of thing (that I know of) unfortunately. If you use Vector3.Scale relative to the centroid of the face, that might work.

What I mean is:

  1. convert the world coordinates (that's what you get when you try to get the verts, right? I haven't had much experience with mesh stuff yet..) to local-relative-to-centroid vectors
  2. scale each of those vectors
  3. apply.
Jul 13 '11 at 05:34 PM Chris D
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

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

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1352
x386
x288
x47
x28

asked: Jul 13 '11 at 03:46 PM

Seen: 972 times

Last Updated: Jul 13 '11 at 05:35 PM