WEB开发网      婵犻潧鍊婚弲顐︽偟椤栨稓闄勯柦妯侯槸閻庤霉濠婂骸浜剧紒杈ㄥ笚閹峰懘鎮╅崹顐ゆ殸婵炴垶鎸撮崑鎾趁归悩鐑橆棄闁搞劌瀛╃粋宥夘敃閿濆柊锕傛煙鐎涙ê鐏f繝濠冨灴閹啴宕熼鍡╀紘婵炲濮惧Λ鍕叏閳哄懎绀夋繛鎴濈-楠炪垽鎮归崶褍妲婚柛銊ュ缁傚秹鏁撻敓锟� ---闂佹寧娲╅幏锟�
开发学院图形图像Flash Papervision3D: understanding Plane object – p... 阅读

Papervision3D: understanding Plane object – part 4

 2009-10-21 00:00:00 来源:WEB开发网 闂侀潧妫撮幏锟�闂佸憡鍨电换鎰版儍椤掑倵鍋撳☉娆嶄沪缂傚稄鎷�婵犫拃鍛粶闁靛洤娲ㄩ埀顒佺⊕閵囩偟绱為敓锟�闂侀潧妫撮幏锟�  闂佺ǹ绻楀▍鏇㈠极閻愬灚瀚梺鍨儏閳ь剙绉归弻銊р偓闈涙啞閻h京鈧敻鍋婇崰鏍х暦閿燂拷
核心提示: 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

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接