开发学院图形图像Flash Papervision3D: understanding Plane object – p... 阅读

Papervision3D: understanding Plane object – part 4

 2009-10-21 00:00:00 来源:WEB开发网   
核心提示: Let’s see what’s new:Line 10: Importing InteractiveScene3DEvent class. It’s the class that will allow us to make objects interacti

Let’s see what’s new:

Line 10: Importing InteractiveScene3DEvent class. It’s the class that will allow us to make objects interactive

Line 12: we also have to declare the viewport in a new way… we need the fourth parameter set to true in order to make the viewport interactive. Interactive objects inside a non-interactive viewport become non-interactive themselves.

Let’s see the four parameters:

viewportWidth:Number (default = 640) — Width of the viewport

viewportHeight:Number (default = 480) — Height of the viewport

autoScaleToStage:Boolean (default = false) — Determines whether the viewport should resize when the stage resizes

interactive:Boolean (default = false) — Determines whether the viewport should listen for Mouse events by creating an InteractiveSceneManager

Lines 16-17: This is the creation of a color material as seen in part 2, but this time I am rendering random colors

Lines 26-27: Making the planes interactive

Lines 30-31: Assigning names to both planes.

Lines 32-33: Adding the listener to planes. InteractiveScene3DEvent.OBJECT_PRESS works in the same way as MouseEvent.CLICK

Now let’s see what happens when I click on a plane:

Line 42: Changing the rotation speed of both planes

Lines 43-50: Retrieving the name of the plane I clicked, and according to its name changing the color of the front or back plane. Please notice I am not changing the plane material, but I am changing the material fill color.

And that’s it:

Click on the rotating plane to see what happens.

上一页  1 2 

Tags:PapervisionD understanding Plane

编辑录入:爽爽 [复制链接] [打 印]
[]
  • 好
  • 好的评价 如果觉得好,就请您
      0%(0)
  • 差
  • 差的评价 如果觉得差,就请您
      0%(0)
赞助商链接