[Papervision3D] Positioning a 3D marker on a sphere based on a sub-MC in its movieclipmaterial
allmandring at googlemail.com
Mon Jul 6 21:11:27 PDT 2009
I'm really struggling with this - hope that someone can help out with the 3D
math. I've tried everything and nothing seems to work.
There are plenty of examples out there doing something similar but with
lat/lang coordinates directly (for example http://blog.zupko.info/?p=221)
but I'm not working with lat/lang but pixels directly.
I have a 3D sphere with movieclipmaterial surface. That movieclipmaterial
has inside it a series of other movieclips - dots basically. What I'd like
to do is position 3D objects (arrows basically) directly above those points
of the sphere.
How would I convert 2D x,y points from the movieclipmaterial surface to the
3D coordinate system of the sphere x,y,z? Any ideas?
var w2:Number = MovieMaterial(sphere.material).rect.width;
var h2:Number = MovieMaterial(sphere.material).rect.height;
var l = MovieClip(MovieMaterial(sphere.material).movie).dot.x *
var lo = MovieClip(MovieMaterial(sphere.material).movie).dot.y *
var x = 500 * (Math.sin(l) * Math.cos(lo));
var y = 500 * (Math.sin(l) * Math.sin(lo));
var z = 500 * Math.cos(l);
3D math doesn't appear to be one of my strengths ... can't believe there is
nothing built in into Papervision to handle things like that by now - or is
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Papervision3D