Papervision3D: Happy New Year, Graphics3D Profile Rotation

Posted by – January 1, 2009

Happy New Year
[Subversion Repo]

I have created a code repository for the ThreeDee Papervision3D extension.
    svn co https://iciifs.com/svn/ThreeDee

Graphics3D now supports profile rotation around the z-axis.
Simply draw a curve using the normal Graphics commands.
Then call endFillSpin(degrees:Number = 360, steps:uint = 20) to create on object based on the rotated curve.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
var light:PointLight3D = new PointLight3D();
light.x = 100;
light.y = 100;
light.z = 2000;
this.scene.addChild(light);
 
var redColor:FlatShadeMaterial = new FlatShadeMaterial(light, 0xff0000, 0xfdfdfd);
redColor.doubleSided = true;
redColor.fillAlpha = 0.5;
 
var greyColor:FlatShadeMaterial = new FlatShadeMaterial(light, 0xdddddd, 0xfdfdfd);
greyColor.doubleSided = true;
greyColor.fillAlpha = 0.5;
 
var greenColor:FlatShadeMaterial = new FlatShadeMaterial(light, 0x28913f, 0xfdfdfd);
greenColor.doubleSided = true;
greenColor.fillAlpha = 0.5;
 
 
var surface3D:Surface3D = new Surface3D();
 
//Draw profile to be rotated around z-axis
surface3D.graphics3D.beginFill(greyColor);
 
surface3D.graphics3D.moveTo(20, 10, -197);
surface3D.graphics3D.lineTo(20, 10, -200);
surface3D.graphics3D.lineTo(10, 20, -200);
surface3D.graphics3D.lineTo(20, 10, -150);
surface3D.graphics3D.lineTo(20, 20, -100);
surface3D.graphics3D.lineTo(4, 0, -70);
surface3D.graphics3D.lineTo(4, 0, -0);
surface3D.graphics3D.lineTo(30, 20, 10);
 
//Rotate profile
surface3D.graphics3D.endFillSpin();
 
surface3D.z = -(-200 + 10)  / 2;
 
this.holder.addChild(surface3D);
 
surface3D = Surface3D(surface3D.clone());
surface3D.material = redColor;
surface3D.x = 80;
this.holder.addChild(surface3D);
 
surface3D = Surface3D(surface3D.clone());
surface3D.material = greenColor;
surface3D.x = -80;
this.holder.addChild(surface3D);
5 Comments on Papervision3D: Happy New Year, Graphics3D Profile Rotation

Respond

  1. saurav says:

    Hi,

    I tried the give code but it doesn’t work.

    I just changed “this.holder” to “this.scene” as it was giving error:

    1119: Access of possibly undefined property holder…

    Can you please help.

    Regards
    Saurav

  2. saurav says:

    Hi,

    Can you please provide me with the complete source code for the above example.

    I think there’s some problem with the PV3D & threedee source code version

    Thanx
    Saurav

  3. Hey thanks for this great library!
    I’m trying to use the latest version from the repository and I noticed that linesPerCurve was removed? Now i se a public static var called segmentsPerCurve but if i set it to a value higher than 4 I get a runtime error… I need a better curve quality than 4.

  4. [...] Papervision3D的强大已经不用我多介绍,现在的FWA已经基本是3D引擎的天下了。除了自身所带的功能以外,大量第三方的辅助类库或插件也起到了锦上添花的作用,所以我把它们并作一条。做粒子效果可以考虑Flint,变形修改器可以用AS3DMod,ThreeDee提供的扩展功能也很不错。至于物理引擎那也很多,只是我目前还没有涉及,这里也不多说了。 [...]

Respond

Comments

Comments