EnhancedPlane: interactivity simplified

Reynaldo May 18th, 2008

Hi all:

I’ve received a few requests in order to make interactivity on the EnhancedPlane class a bit more simple and straight forward, [EDIT: link updated] so here it is ;) . In order to get it working, you would have to import the InteractiveScene3DEvent event class:

import org.papervision3d.events.InteractiveScene3DEvent;

Now, set up your EnhancedPlane as so

[source language='Ruby']
var frontMaterial:MovieAssetMaterial = new MovieAssetMaterial(”front”, true);
var backMaterial:MovieAssetMaterial = new MovieAssetMaterial(”back”, true);

var materials:MaterialsList = new MaterialsList({
ront: frontMaterial,
back: backMaterial
});

doublePlane = new EnhancedPlane(materials, 250, 250, 16);
doublePlane.interactive = true;
doublePlane.addEventListener(InteractiveScene3DEvent.OBJECT_CLICK, rotatePlane);

view.scene.addChild(doublePlane);
[/source]

As you can see, the EnhancedPlane class now has an interactive property which accepts a Boolean value, then simply listen to an InteractiveScene3DEvent and your set!

[EDIT] To access each side of the plane individually, all you have to do is

[source language='Ruby']

doublePlane.front

[/source]

[source language='Ruby']

doublePlane.back

[/source]

Trackback URI | Comments RSS

Leave a Reply

  • Friends

  • Props

  • Donations

  • website counter
  • Archives

  • Feedburner