这是我第一次使用Papervision3D,我创建了一个在y轴上倾斜的图像的幻灯片。左边的照片最小,右边的照片变大。所以它们从左到右,从小到大。
我有一个工具提示,当你将鼠标悬停在照片上时会弹出,但工具提示也会与相机视图成比例地倾斜(倾斜)。我希望工具提示的角度独立于整个相机视图。
你知道如何独立于父母的相机角度旋转对象吗?
谢谢!
发布于 2009-09-04 19:29:39
my_obj =新的DisplayObject3D();my_plane =my_obj.addChild(新平面(Bla bla));my_obj.lookAt(相机);
'lookAt‘部分就是你需要的。
发布于 2009-09-05 11:51:40
为什么不在2d中绘制工具提示呢?你可以得到图片的屏幕位置,然后像这样画一个普通的雪碧图:
package
{
import flash.display.Sprite;
import flash.text.TextField;
import org.papervision3d.events.InteractiveScene3DEvent;
import org.papervision3d.materials.ColorMaterial;
import org.papervision3d.objects.DisplayObject3D;
import org.papervision3d.objects.primitives.Plane;
import org.papervision3d.typography.Text3D;
import org.papervision3d.view.BasicView;
public class PVTest extends Sprite
{
private var world:BasicView;
private var text:Text3D;
private var text2d:TextField;
public function PVTest()
{
world = new BasicView(stage.width, stage.height, true, true);
var colorMat:ColorMaterial = new ColorMaterial();
colorMat.interactive = true;
var planeContainer:DisplayObject3D = new DisplayObject3D();
var plane:Plane;
for(var i:int = 0; i < 11; i++)
{
plane= new Plane(
colorMat,
100, 100,
10);
plane.x = (i * 105) - 500;
plane.addEventListener(InteractiveScene3DEvent.OBJECT_OVER, handleMouseOver);
plane.addEventListener(InteractiveScene3DEvent.OBJECT_OUT, handleMouseOut);
planeContainer.addChild(plane);
}
planeContainer.rotationY = 10;
world.scene.addChild(planeContainer);
world.camera.z = -500;
addChild(world);
world.startRendering();
}
private function handleMouseOver(event:InteractiveScene3DEvent):void
{
var plane:Plane = Plane(event.displayObject3D);
plane.calculateScreenCoords(world.camera);
const OFFSET_X:int = -20;
const OFFSET_Y:int = 30;
text2d = new TextField();
text2d.text = "toolTip";
text2d.x = plane.screen.x + (stage.width/2) + OFFSET_X;
text2d.y = plane.screen.y + (stage.height/2) + OFFSET_Y;
addChild(text2d);
}
private function handleMouseOut(event:InteractiveScene3DEvent):void
{
removeChild(text2d);
}
}
}即使对于这个例子,你也必须根据对象的比例来偏移工具提示的y位置,但这可能比计算旋转更容易,并且是获得一致外观结果的最佳方法。
https://stackoverflow.com/questions/1380289
复制相似问题