Hi Kiranjit,

For starters, remove the other two rotation fields from this code. Those

two fields are rotating the two table tops at an odd angle respecting the

legs.

Now fix the positions of the legs. Since they are all even in the vertical

direction, their Y values are fine.

The X and Z values of the table legs should be chosen so that each leg is at

a unique corner of a rectangle; the table tops are rectangular and they need

evenly space legs that form the same pattern.

Look at the translations you have for the table legs:

translation 0.0 -1.5 0.0

translation 2.25 -1.5 0.0

translation 2.25 -1.5 0.0

translation 2.25 -1.5 -2.5

Notice they all have the same Y value (-1.5)? That's good; but we already

know that.

Also notice that the X and Z values aren't defining the corner positions of

a rectangle. That's what needs to be fixed now!

Everything will be easiest if you center this imaginary rectangle at X=0,

Z=0. Then you can easily assign values for X that are equal distances on

each side of X=0; and also assign values for Y that are equal distance from

Y=0.

How widely should the legs be spaced? Since the table top is 6 meters by

2.5 meters (everything in vrml is in meters, if practical), and since the

legs should be under the table (rather than right at the edge), let's make

the imaginary rectangle 4.5 meters by 2 meters large.

Since half of 4.5 is 2.25, and half of 2 is 1, you might try using these X

and Z values in the translations of the table legs:

translation 2.25 -1.5 1.0

translation 2.25 -1.5 -1.0

translation -2.25 -1.5 1.0

translation -2.25 -1.5 -1.0

So the first two legs are at one end of the table, where X = 2.25.

And the other two legs are at the other end, where X=2.25

At each end of the table, one leg is offset to one side (Y=1.0)

and the other is offset the opposite amount (Y= -1.0).

And.. Presto! You're done! The table looks good!

--------------------------------------

Now, if you want to refine your table design, here are a few tips:

1. Everything in VRML is measured in meters so that you can easily mix all

your furniture together in one room.

2. Is your table too tall? Is it too long? If so, you can wrap the whole

table inside a Transform node, and use the "scale" field to rescale the

table in all three directions at one time.

3. Consider using *thinner* boards and thinner legs for your next table.

Would it add style to make the lower board a little narrower (in the Z

direction) than the top board? Maybe round legs would look nice too?

4. And you can add a texture to the surfaces, using a picture of the

surface of wood; or you can play with the different kinds of color, and

reflection and shininess, to make it look like metal or plastic.

But the table is already very nice!

If you want to rescale it, you could wrap it inside a Transform node like

this one:

Transform {

scale 0.5 0.5 0.5

children [

... legs and boards go in here...

]

Quote:

}

Of course, you won't see this rescaling when you look at just one table;

this is done to help it match properly with other furniture and avatars

inside of virtual buildings.

One more tip: if you expect to use a lot of furniture in the building that

you decorate, you can put a Group{} statement inside of the Transform{}

statement. This tells the VRML browser that these furniture parts will stay

together.

For example:

Transform {

scale 0.5 0.5 0.5

children Group {

children [

... legs and boards go in here...

]

}

Quote:

}

And of course you can give this Transform a name, using a DEF statement, to

make it easier to make several copies of it inside a world. But you already

know how to do that - you did it to make the four legs easily. Good show!

Have fun,

Bob Greer

---------------------------------------------------------------------------

------

Quote:

>Hi ,

>Sorry to be a pain but I am very new to VRML, and have been trying

>to get this table to look decent. The base seems okay but the legs

>are not right.

>Please could some one put them right for me and make this table look

>like a table.

>Many Thanks

>Kenny.

>#VRML V2.0 utf8

>Group

>{

> children

> [

> Transform

> {

> translation 0.0 0.0 0.0

> rotation 1.0 0.0 0.0 0.5

> children DEF base1 Shape

> {

> appearance DEF wood Appearance

> {

> material Material

> {

> diffuseColor 0.97 0.69 0.49

> }

> }

> geometry Box

> {

> size 6.0 0.25 2.5

> }

> }

> }

> Transform

> {

> translation 0.0 -0.25 -0.75

> rotation 1.0 0.0 0.0 0.5

> children DEF base2 Shape

> {

> appearance USE wood

> geometry Box

> {

> size 5.5 0.25 2.5

> }

> }

> }

> Transform

> {

> translation -2.25 -1.5 0.0

> #rotation 0.0 0.0 0.0 0.5

> children DEF leg Shape

> {

> appearance USE wood

> geometry Box

> {

> size 0.25 2.5 0.25

> }

> }

> }

> Transform

> {

> translation 2.25 -1.5 0.0

> #rotation 1.0 -1.5 0.0 0.5

> children USE leg

> }

> Transform

> {

> translation -2.25 -1.5 -2.5

> #rotation 1.0 -1.5 0.0 0.5

> children USE leg

> }

> Transform

> {

> translation 2.25 -1.5 -2.5

> #rotation 1.0 -1.5 0.0 0.5

> children USE leg

> }

> ]

>}