I did try your code, but if a path point is on 0 there's no value for
scales to multiply. I made an example. I tried only scaling the z
value like you said:
var scales:Array = new Array(
new Number3D(1, 1, 4),
new Number3D(1, 1, 3.6),
new Number3D(1, 1, 3.2),
new Number3D(1, 1, 2.8),
new Number3D(1, 1, 2.4),
new Number3D(1, 1, 2),
new Number3D(1, 1, 1.6),
new Number3D(1, 1, 1.4),
new Number3D(1, 1, 1.2),
new Number3D(1, 1, 1.1),
new Number3D(1, 1, 1))
I created two paths, both only moving along the x axis, but one is
offset y and z by 100:
var extrudePath:Path = new Path([
new Number3D(-250, 100, 100), null, new Number3D(-200,100, 100),
null, null, new Number3D(-150, 100, 100),
null, null, new Number3D(-100, 100, 100),
null, null, new Number3D(-50, 100, 100),
null, null, new Number3D(0, 100, 100),
null, null, new Number3D(50, 100, 100),
null, null, new Number3D(100, 100, 100),
null, null, new Number3D(150, 100, 100),
null, null, new Number3D(200, 100, 100),
null, null, new Number3D(250, 100, 100)
]);
extrudePath.smoothPath()
extrudePath.worldAxis = new Number3D(0,0,1);
var extrudePath2:Path = new Path([
new Number3D(-250, 0, 0), null, new Number3D(-200,0, 0),
null, null, new Number3D(-150, 0, 0),
null, null, new Number3D(-100, 0, 0),
null, null, new Number3D(-50, 0, 0),
null, null, new Number3D(0, 0, 0),
null, null, new Number3D(50, 0, 0),
null, null, new Number3D(100, 0, 0),
null, null, new Number3D(150, 0, 0),
null, null, new Number3D(200, 0, 0),
null, null, new Number3D(250, 0, 0)
]);
extrudePath2.smoothPath()
extrudePath2.worldAxis = new Number3D(0,0,1);
I created two extrudes from these paths with the same profile, scale,
and ini values. The end result is this:http://sibhod.com/away3d/scaleTest2.swf
It seems to work fine if you only scale a point's dimension that's on
0. How do I make it only scale the profile?
On Feb 6, 7:29 pm, Fabrice <[email protected]> wrote:
yes makes sens, again, smoothscale:true
and pass per segment a Number3d in the array
it should look like this (1,1,1), (1,1, 1.2), (1,1, 1.4) etc.. one
per
segment
if aligntopath is true and your path is valid, you should be able to
build that shape
Declare the profile only using x,y values and let all z to 0 to make
it work without having to edit the orientation vector.
(Pathextrude.worldaxis)
the profile must also distributed on the x and y axis like
-10/10. if
not, you'll end with an offset, the profile would not be centered
along the Path.
Did you run the code I've gave you?
because if you pass a circular shape, and edit the path info you'll
get that shape.
Fabrice
On Feb 6, 2009, at 11:12 PM, sibhod wrote:
Ok, so scales do not work how I was thinking.
Maybe I should just explain what I am attempting. I would like to
be
able to draw a curvy path in 3d, and have a profile extrude and
taper
along the path without modifying the path positions. I attempted to
divide each path point's position by it's scale value to offset the
scale multiplication, and I ended up with a sloppy looking extrude:
http://sibhod.com/away3d/scalesTestInvert.swf
I created a quick visual of what I am attempting with a cylinder
and
modifiers here:
http://sibhod.com/away3d/taperExample.swf
I would like to be able to keep the extrude path the same, while
scaling only the extruded profile. Does that make sense?
Thanks Fabrice!
On Feb 6, 1:01 pm, Fabrice <[email protected]> wrote:
Hey Sibhod,
yes, you do wrong :)
The scale Number3D's are multipliers, when smoothscale is true
their
respective values are interpolated on a linear way. They are
applied
on the transformed vertexes.
if you mulitply by zero a vector property, chances are high you
will
have some vertexes going wild in the final piece. If you want they
remain unchanged it must be (1,1,1).
This is also the default set when you do not pass a scales array.
Look at previous example. only the z factor were changed. this
depends
on the way you define the profile and how the shape is projected
to
the path in case of aligntopath:true.
in this case it is using the xy plan for the profile. Try my
code and
pass for a second one null, you will see they will have exact same
length.
A quick tip: just pass (1,1,1) and on the second or third
CurveSegment, pas (1,1,3) , if its affecting the position, try
(1,3,1);
in your case you affect the 3 axes. Witch is from what you
explain,
not what you want.
In case you are using different projection or path definitions,
try
set the PathExtrude.worldaxis property. the default is 0,1,0, try
0,0,1 instead.
Fabrice
On Feb 6, 2009, at 7:38 PM, sibhod wrote:
Hey Frabrice,
I updated from the svn, but unless I'm doing something wrong it's
still not quite fixed. If you do a scale from a (0,0,0) point
then
scales can't affect the position.
Here's a quick example I made to try and highlight the issue
better:
http://sibhod.com/away3d/scalesTest.swf
These are two identical pathExtrudes, except the y positions are
inverted. The top extrude is constructed with 'null' for the
scales
arg, and the bottom extrude has a scales array graduating from
(2,
2,
2) to (1, 1, 1). This isn't how it's supposed to work, right?
Thanks!
On Jan 29, 11:00 am, sibhod <[email protected]>
wrote:
Thanks for the quick response! I'll update my files.
On Jan 29, 8:54 am, Fabrice <[email protected]> wrote:
Hey sibhod,
thanks for pointing out that one.
was little but nasty.
http://www.closier.nl/playground/PathExtrude_scalefix.swf
this is the test code I've quickly typed to make that fixe
var aPoints = [];
//square
aPoints.push(new Number3D(-100, 100,
0));
aPoints.push(new Number3D(0, 100, 0));
aPoints.push(new Number3D(100, 100,
0));
aPoints.push(new Number3D(100, 0, 0));
aPoints.push(new Number3D(100, -100,
0));
aPoints.push(new Number3D(0, -100, 0));
aPoints.push(new Number3D(-100, -100,
0));
aPoints.push(new Number3D(-100, 0, 0));
aPoints.push(new Number3D(-100, 100,
0));
var aPath:Array = [ new
Number3D(-500, 0,
0), new Number3D(-250, 0,
0), new Number3D(0, 0, 0)];
var path:Path = new Path(aPath);
var aScale = [];
aScale.push(new Number3D(1, 1, 1));
aScale.push(new Number3D(1, 1, 3));
pathextrude= new PathExtrude(path,
aPoints, aScale, null,
{smoothscale:true, flip:false, aligntopath:true, coverall:true,
scaling:6, closepath:false, recenter:false, material:mat,
subdivision:
10, bothsides:false});
this.scene.addChild(pathextrude);
displays now exactly as expected.
svn is updated
Fabrice
On Jan 29, 2009, at 7:12 AM, sibhod wrote:
I updated to the latest svn trunk, and tried many different
methods,
but the "scales" prop on PathExtrude still doesn't work the
way I
expect it.
For example, if I have a simple square profile extruded on a
one-
segment path that runs from (100, 100, 100) to (-100, -100,
-100)
it
appears like a diagonal rectangular box. The problems appear
when I
attempt to usescales, with or without smoothscale. If I want
the
box
to taper as it extrudes, I pass ascalesparam: new Array(new
Number3D
(1,1,1), new Number3D(3, 3, 3)). Not only does the profile
scale,
but
the v1 point is now well beyond (-100, -100, -100), and
appears
to be
multiplied by the scale as well.
Also, the extrude seems to add an extra segment to the profile
that
returns to the last point in the extrude path, unscaled. I've
found a
cheap work-around where my path generator divides each segment
position by its scale, but I wanted to see if I am doing
something
wrong.
Thanks again!
On Jan 26, 7:46 pm, sibhod <[email protected]>
wrote:
I haven't had a chance to try out your suggestions, but I
wanted
to
that you so much for your help! I'll be sure to post my
results
when I
finally have some.
On Jan 15, 5:33 pm, Fabrice <[email protected]> wrote:
ThepathExtrudedo not change the points coordinates except if
you
pass aligntopath:true
the scale works per Curvesegments, and a scale Number3D is
required
for that segment.
you just pass a series of Number3D's in an array and they
will
affect
the whole segment. Smoothscale prop will define if its
...
read more ยป