Scaling U and V coords separately

Software: Away3D 4.x

Parez, Newbie
Posted: 12 January 2012 12:51 PM   Total Posts: 11

Hi,
It seems strange but I notised that the Geometry class method scaleUV accepts only one parameter, though everyone suggests to call it like mymesh.geometry.scaleUV(n,m).
Here is the quote from official documentation:

scaleUV () method
public function scaleUV(scale:Number):void
Scales the uv coordinates.

Parameters

scale:Number — The amount by which to scale.

So the question is: Is it possible to scale U and V coordinates separately?
Thanks.

   

John Brookes, Moderator
Posted: 12 January 2012 01:26 PM   Total Posts: 732   [ # 1 ]

Use this version
https://github.com/away3d/away3d-core-fp11

   

Parez, Newbie
Posted: 12 January 2012 01:43 PM   Total Posts: 11   [ # 2 ]

Thanks. Is it the newest one?
And another question: can I set different UV scaling for each side of the cube?

   

John Brookes, Moderator
Posted: 12 January 2012 03:56 PM   Total Posts: 732   [ # 3 ]

Depends what you call newest.

Most of the examples and most of what you see that have been posted on here will be using the master branch.
So if you starting out and know very little maybe that branch would be the one for you. At least you can get going.

BUT
It will change to what is currently in the Dev branch.

And there are quite a few differences between them.
The Dev branch has hardly any examples, so will be harder to pick up, but eventually your going to need to know it.
(In theory)

Also stuff can change without warning.
Well maybe a tweet ot so.

tweet
richardolsson
Pushed a small (but impactful) refactor of the #Away3D dev branch
in which primitives are now Geometry sub-classes, instead of meshes.


As for the cube.
No.
Also its has a bug with cube6 mapping (in both branches).

It a case of create you own cube class that has a subgeometry for each side.

Or more easily use 6 planes as a cube, you then have more control.

   

Parez, Newbie
Posted: 12 January 2012 04:27 PM   Total Posts: 11   [ # 4 ]

Thanks for so detailed explanation.

About UV scaling: then how should I normally avoid such problems (which you can see at the tops of the walls). I managed to set appropriate UV scaling for walls’ sides but walls’ tops look terrible (texture is flattened):
http://parez.gixx.ru/Maze.html

By the way, here I use LinearExtrude instead of cubes. But I guess that I can’t do different UV scaling here as well.

   

Avatar
Fabrice Closier, Administrator
Posted: 12 January 2012 04:41 PM   Total Posts: 1265   [ # 5 ]

Parez, again, if you define your segments with all same length, like if your maze is defined on a grid, you do not even need repeat, Linearextrude will do it for you, if you set coverAll boolean to false… then using seamless square map, it will look marvelous. no distort, no stretch, a maze ing smile

   

Parez, Newbie
Posted: 12 January 2012 05:07 PM   Total Posts: 11   [ # 6 ]

Sorry. English is not my native language so I’m not sure if I understood you correctly. You mean creating maze from square blocks? Then the width of the wall will be equal to it’s height.. And how should I do so with LinearExtrude class? If I’d like to build a vertical wall (like in the link) I should do something like that?

for(var i:uint 0totalHeighti+=wallWidth)
{
 wallsVector
.push(new Vector3D(0,i,0));
}
wallsExtrusion 
= new LinearExtrude(null,wallsVectors,LinearExtrude.Y_AXIS,wallWidth,3,false,wallWidth,3,multy,false,false,""); 

Am I right?

   

John Brookes, Moderator
Posted: 12 January 2012 07:48 PM   Total Posts: 732   [ # 7 ]

Fabrice

Think theres a bug in linearExtrude.

Using the demo in examples
https://raw.github.com/away3d/away3d-examples-broomstick/master/src/LinearExtrudeTest.as

Change path to
var path:Vector.<Vector3D> = Vector.<Vector3D>([new Vector3D( -500, 0, 0),
    new Vector3D( -250, 0, 0),
    new Vector3D(0, 0, 0),
    new Vector3D(250, 0, 0),
    new Vector3D(500, 0, 0),
    new Vector3D(750, 0, 0)]);

It only repeats after crossing XY plane.
Or if you change direction.
But a straight path doesnt change tiling.

Little hack is to add a small Z value.
eg
var path:Vector.<Vector3D> = Vector.<Vector3D>([new Vector3D( -500, 0, 1),
    new Vector3D( -250, 0, 0),
    new Vector3D(0, 0, 0),
    new Vector3D(250, 0, 0),
    new Vector3D(500, 0, 1),
    new Vector3D(750, 0, 0)]);


Perez
And it is possible to change UV mapping on cube. Just worked it out.
Ill post later.
But for a maze linearExtrude would be easier. (if it worked)

   

Avatar
Fabrice Closier, Administrator
Posted: 13 January 2012 09:33 AM   Total Posts: 1265   [ # 8 ]

Just runned a small test and was able to reproduce. Indeed this is a bug, I’ll look at it asap. Well spoted!

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X