This article has been moved to: http://www.x-com.se/labs
Make sure to visit this new blog for great articles and tutorials regarding PV3D and other flash related subjects.
/Andreas
This article has been moved to: http://www.x-com.se/labs
Make sure to visit this new blog for great articles and tutorials regarding PV3D and other flash related subjects.
/Andreas
« Why can’t we just get along?? Multiplayer in Flash – How to.. »
Best article about ViewportLayers since the Zupko one :) Thanks!
On a side note, if you want to get buttonMode on all your objects, the easiest way to do it is setting viewport.buttonMode to true, so you don’t have to do it for every ViewportLayer.
However, I don’t recommend doing it that way cause at some time, you may decide some DO3D shouldn’t have buttonMode and you can’t do it anymore because when viewport.buttonMode is true, setting buttonMode on a ViewportLayer doesn’t change anything.
Thanx, good stuff
Have problems with this atm so will try it out :)
Thanx for this, I have no clue with papervision (yet) and your posts helps a lot with certain things.
Thank you all! I really have enjoyed starting up this even more than I thought I would. It’s quite busy at work at the moment but as soon as it settles I will try t continue on the game.
Awesome ! been wanting to either write something or find something in depth on viewports
just one question here. When I do this tutorial it all works great. I get an error with this bit though.
viewport.containerSprite.sortMode = ViewportLayerSortMode.INDEX_SORT;
it gives me this error.
H:\…\View3d.as(64): col: 40 Error: Access of undefined property ViewportLayerSortMode.
I figured it must be something that I didn’t import bit I don’t really know what the problem is.
franco: yes, you need to import:
import org.papervision3d.view.layer.util.ViewportLayerSortMode;
to be able to get those constants. I missed that part as I mostly work with autogenerating imports.
Thanks man!
I was wondering about that 2
thank you.
Thanks for this great article, it’s very useful !
But I have a little problem when I try ti use DO3D.useOwnContainer and DO3D.filters.
I have a Sphere and I move this Sphere behind a Cube, but when this Sphere has filters, the layer with filters is display in front of the Cube.
You can see my problem here :
This problem is maybe due to z-sorting…
Any ideas how to fix this problem?
I just wanted to drop a comment to appreciate your article
It helped me a lot to understand ViewportLayer
Most of the PV3D blogs have many cool examples, but not many blogs for basic concept.
This is definitely one of them and I will keep it in my list.
I tried to vote on the forum, but it seems that the server has some issue.
I will try later. Thanks.
Very clear & useful explanation,
thanks a lot !
I was trying to sort a DAE and a DisplayObject3D following this tutorial but I couldn’t…. These two display object don’t respect the layer structure. Is there any way to do this….
Thank you….
Thank for this all precision about this obscure class. But i’ve just one question about the useOwnContainer method.
I have something like this. i hope is clear…
— using useOwnContainer to apply a GlowEffect
And all it’s fine.
But when i try somenthing like this
— using useOwnContainer for alpha and blur
— using useOwnContainer to apply a GlowEffect
Alpha and blur are applied to the DO3D but the GlowEffect on sphere disapear.
it’s seams to be impossible to use useOwnContainer = true inside an useOwnContainer ?
Sorry something wrong with the format in my last post
I have something like this. i hope is clear…
DO3D
|-sphere <— using useOwnContainer to apply a GlowEffect
|- plane <– nothing applied
And all it’s fine.
But when i try somenthing like this
DO3D <— using useOwnContainer for alpha and blur
|-sphere <— using useOwnContainer to apply a GlowEffect
|- plane <– nothing applied
Alpha and blur are applied to the DO3D but the GlowEffect on sphere disapear.
it’s seams to be impossible to use useOwnContainer = true inside an useOwnContainer ?
Hi,
I made a ring using telerenak.org’s script and it rotates around a sphere, each object has a filter glow added to them. when using useOwnCanvas on both objects, the planet always sits on top, when i use viewportLayer, it fixes the problem but i’d lose the filter glow, do u have an idea of what to do? please help, thank.
Another great article!
I was trying to figure out how you manage the layers in your game. You have a static class with static constants? How do you initiate the layers?
Never understood the viewportLayer thing that well, untill i read this blog!
Thank you very much for the explanation.
Wow, you helped me a lot!
Hi.
I´ve followed yor great tutorial and everything was ok. So I decide make use of the same thecnique in my simple “memory card” game.
So I have two display objects3D: “floor” and “cardsHolder”. The cardsHolder do3D is builded with 15 cubes inside of it. And this is the unique difference between “wall” and “floor”. But the cardsHolder is always under floor.
This is a link to my example:
http://www.pedropauloalmeida.com.br/my-uploads/pv3d/pv3d_example.zip
Could you help me on this?
Thanks in advice!
pedro paulo almeida
You might want to mention that when you move more complicated objects into layers such as .DAE objects, that there is a 2nd parameter in ViewportLayer.addDisplayObject3D(obj, recurse : Boolean) which also adds all children of the DisplayObject being added. Default it’s set to false, which is why at first your tutorial appeared not to work for me.. (DAE objects have the actual triangles etc. hidden in children).
Btw, the index sorting doesn’t work for me. It always draws them in the same order regardless of what I do to the indices.. But it’ll probably turn out to be something silly (as usual)….
Oh and make sure you wait until your .DAE is fully loaded before putting everything in ViewportLayers … ! (this took me a while to figure out)
I am trying to get this to work for my dae models. I have 3 flat layers being stacked on top of one another and they are not showing up correctly. Here is a code snippet:
var view:BasicView=new BasicView(stage.stageWidth,stage.stageHeight,false,false,CameraType.FREE);
view.scene.addChild(daeAsphalt);
view.scene.addChild(daeCement);
view.scene.addChild(daeGrass);
// this time, let’s use the viewport to create layers, through objects.
// true means that if ‘sphere’ does not belong to a layer, create one for it and put it there.
var grassLayer:ViewportLayer = view.viewport.getChildLayer(daeGrass, true);
var cementLayer:ViewportLayer = view.viewport.getChildLayer(daeCement, true);
var asphaltLayer:ViewportLayer = view.viewport.getChildLayer(daeAsphalt, true);
view.viewport.containerSprite.sortMode = ViewportLayerSortMode.INDEX_SORT;
// set the sort index of the new layer
grassLayer.layerIndex = 1
cementLayer.layerIndex = 2
asphaltLayer.layerIndex = 3
// add our objects to the new layers
grassLayer.addDisplayObject3D(daeGrass, true)
cementLayer.addDisplayObject3D(daeCement, true)
asphaltLayer.addDisplayObject3D(daeAsphalt, true)
Any Ideas what could be wrong??
Hello,
How can I use viewportlayers with Augmented reality and DAE files? I can get it work.
THanks