使用papervision创建3d游戏
现在我需要在屏幕上添加健康栏和倒计时器。
我该怎么做?在 3D 场景中添加飞机?健康栏始终位于屏幕的右上角。无论如何,有没有不使用 3D 概念来实现这一点的方法?我的意思是我可以用一架飞机来做到这一点,不断改变它的纹理来显示角色的状态。有没有更干净的方法来做到这一点?
提前致谢!
now i need to add a health bar and countdown timer on the screen.
how am i going to do it? adding a plane in the 3d scene? the health bar is always on the top right corner of the screen. is there anyway of NOT using 3d concept to implement this. i mean i could do it with a plane keep changing it's texture to show the status of the character. is there any cleaner way of doing it?
thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不明白为什么您只需将 UI 元素添加到显示列表的根目录就会遇到任何问题。我不相信 papervision 能够完全控制显示,IIRC 它看起来像这样:
因为显然,除了 PV3D 自己的容器之外,根目录可以拥有任意数量的 DisplayObject 子级。因此,在设置 PV3d 并将其添加到显示中的代码之后,只需添加一个包含您的健康栏的新 DisplayObject 即可。然后交换两者的深度索引,以便您的 UI DisplayObject 出现在 PV3D 对象的前面。
免责声明:这全是我的记忆,自从我上次使用旧的 AS3 以来已经有一年了。
I don't see why you should have any problem simply adding your UI elements to the root of the display list. I don't believe papervision takes complete control of the display, IIRC it looks like this:
Because obviously, the root can have as many DisplayObject children as you like, aside from PV3D's own container. So after the code where you set up PV3d and it gets added to the display, just add a new DisplayObject containing your healthbar. Then swap the depth indices of the two so that your UI DisplayObject appears in front of the PV3D object.
DISCLAIMER: This is all from memory, it's been a year since I last used good old AS3.