[Away3D] How to get sprite always on top of view

120 views
Skip to first unread message

Stephen Hopkins

unread,
Jul 30, 2010, 7:10:08 PM7/30/10
to Away3D.dev
I was using sprite2d to display bitmapdata in 3.5. In 3.5.1, do we use
MovieClipSprites?

Also is there a way to get sprites to always be on top(showing) other
than having another view3D that is on top? I have tried setting
deltaZ(before 3.5.1) to make them right in front of the camera but
this also affects the size of the sprite. I want them to scale based
on distance but they need to alway be on top no matter what is in
front of them. This would be really useful for displaying reticles/
targeting sprites.

Thanks

Stephen Hopkins

unread,
Jul 30, 2010, 8:08:27 PM7/30/10
to Away3D.dev
It seems something is wrong with setting the Sprite3D coordinates too.
My sprites do not show up in my Object3DContainer unless they are
positioned at (0, 0, 0)

Stephen Hopkins

unread,
Jul 31, 2010, 6:50:17 PM7/31/10
to Away3D.dev
Ok, Here is what i am doing and how I think you can reproduce the
problem

create object3dcontainer
create sprite and set z to 50
add sprite to object3dcontainer
add object3dcontainer to view.scene

Test the scene
Sprite doesn't show up.

Create another sprite3d, but add it to view.scene directly instead of
in the container.

Now the sprite shows up

Stephen Hopkins

unread,
Aug 1, 2010, 6:00:03 AM8/1/10
to Away3D.dev
Frustum clipping also seems to be causing some problems here, but the
above still holds true. I found another post by Rob
http://groups.google.com/group/away3d-dev/browse_thread/thread/e8505311fc8d80c/61f856f4b421fd54?lnk=gst&q=frustum+clipping+sprite3d#61f856f4b421fd54

but his suggested workaround is no longer possible without removing
this line
if (!val)
throw new Error("objectCulling requires setting to true for
FrustumClipping");

Toidas

unread,
Jul 28, 2011, 3:12:43 AM7/28/11
to away3...@googlegroups.com
I am having the same problem. I want for a Sprite3D to always be on top, but I can't find any tutorial/reference with explanation. Moreover, distanceScaling doesn't seem to affect something at all. Set it 'true' or 'false', the Sprite3D object acts in exactly the same way.

Toidas

unread,
Jul 28, 2011, 3:19:10 AM7/28/11
to away3...@googlegroups.com
All the objects in the scene have ownCanvas set to true. That's the only way I've found to avoid serious Z-sorting problems (CORRECT_Z_ORDER is too computationally expensive). Is there any way out of the problem? Do I need to set ownCanvas to false and look for other solutions? The flash movie might be accessed here: http://tadas.asmeninis.com/teravil/flash/example. The code which initializes the Sprite3D object I'm talking about:
tekstas_material = new BitmapFileMaterial( "sample_area.jpg" ); 
tekstas = new Sprite3D( tekstas_material ); 
imageLoader = null; 
tekstas.x = dangtis.x - 40; 
tekstas.y = dangtis.y + 20; 
tekstas.z = dangtis.z + 10; 
tekstas.scaling = 0.15; 
view.scene.addSprite( tekstas );
Reply all
Reply to author
Forward
0 new messages