x


Draw a line via script and make a solid with it..

Hello everybody! I'd like to know how to draw lines via script to make a solid figure, for example a cube, a triangle or a circle. After this I'd like to "extrude" the shape and give it a size (thickness).

I found Handles.Drawline on the help and this is the code I wrote:

var dot1 : Vector3;
dot1.x=0;
dot1.y=0;
dot1.z=0;

var dot2 : Vector3;
dot2.x=100;
dot2.y=0;
dot2.z=0;

function Start()
{

var linea = Handles.DrawLine(dot1,dot2);

}

This gives me an error: Unknown identifier : Handles. Where is my error?

And then when I finally create my line and my shape how do I extrude it? Thank you very much.

more ▼

asked Mar 19 '10 at 04:31 PM

Dave83 gravatar image

Dave83
1 1 1 1

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

1 answer: sort voted first

Handles is an editor class, and can only be used in editor scripts (which must be placed in a folder called Editor in your project's Assets folder), and will only work in the editor.

To create solid shapes, you don't need to extrude anything; use the Mesh class.

Just so you know, you can declare variables like this:

var dot1 = Vector3(0, 0, 0);

(or in that particular case, "Vector3.zero".)

more ▼

answered Mar 19 '10 at 05:44 PM

Eric5h5 gravatar image

Eric5h5
81.5k 42 133 529

(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:

x3893
x129
x66
x8

asked: Mar 19 '10 at 04:31 PM

Seen: 2384 times

Last Updated: Mar 19 '10 at 05:48 PM