How to anchor objects to a floor?

1 view
Skip to first unread message

zu

unread,
Jun 30, 2008, 9:57:25 PM6/30/08
to away3d.dev
These are a few noobie questions, so please excuse if it has been
answered before.

I'm working on a small app where I have a few markers on a map:
http://sprit3.net/misc/away3D/test1.swf

The floor is a Plane with a BitmapMaterial assigned. And the two
markers, one is a MovieClipSprite and the other a Plane with a
BitmapMaterial. The complete code is here: http://sprit3.net/misc/away3D/Test1.as

My questions are:

1. How can I make it seem like the markers are pinned on the floor (to
the spots in black)? At present, the markers seem to move on the floor
when the camera is panned/tilted.

2. As you can see from the example, the marker with the BitmapMaterial
looks aliased around the edge. Hence, I've opted for the
MovieClipSprite. Is there a better way to do this?? Does the
MovieClipSprite take up more CPU?

3. When using a MovieClipSpite, how is it best to setup the source
object in the library - should the registration point be set to object
0,0 or the centre?

Finally, is there any reference of resource usage of the various
material types or some sort of optimisation guide?


Thanks for any help! :)

Fabrice

unread,
Jul 1, 2008, 4:05:36 AM7/1/08
to away3...@googlegroups.com
Hi Zu,
they move because the registration point is not located at the point
that should be on floor level.

1/ first problem (will be fixed soon)
right now the system do center the sprite
line 70
_sc.x -= movieclip.width/2;
_sc.y -= movieclip.height/2;

so before we add some string options to lock the registration point
(like right, left, center, tp left...)
in your case
replace the _sc.y by the one you need.
place the graphics accordingly into your movieclip.

2/ you have a scale and scaling parameter, try to find the scale where
your source is shown one on 1/1
it would allow you to use a lower quality on your stage without too
much loss on screen.

3/ I've just done a project with a friend where the 3D scene is on top
of a movieclip with animation
the amount of cpu needed doubled. stopping the underlayer lowered the
fps.
the fixe was to set view.cacheBitmap = true;

same rule for overlays.
and try to stop all enterframe if nothing happends, try to remove all
mouse listenners where applicable.
and reset them later on.

we've been from a 90+% cpu activity on this project to a 7% iddle, 49%
runtime doing this.
that's the different with a slow/sticky interraction and a smooth one.
On older machines the mouse was feeling like it was 30 kilos at first
while now it runs and feels smooth.

The best way to work, is to build all you really need and them work
with taksmanager (win) or Activity Monitor (mac)
and set stuffs on/off and measure and try improve all the guys killing
your perf.
There is no perfect solution, it's all about experience and trial/
error. It's all about balance.

Fabrice

zu

unread,
Jul 8, 2008, 3:22:17 AM7/8/08
to away3d.dev
Hi Fabrice,

Thanks a lot for your comments! I managed to edit the centre point as
you've pointed out :) Also that tip about the cacheAsBitmap lead to a
fair amount of speed improvement!

This was my first real 3D widget that I've done - which went pretty
well thanks to the AWAY3D engine! Looking forward to doing lots
more! :)

zu
Reply all
Reply to author
Forward
0 new messages