« Return to Thread: Positioning a 3D marker on a sphere based on a sub-MC in its movieclipmaterial

Re: Positioning a 3D marker on a sphere based on asub-MC in its movieclipmaterial

by Antoine Azar - 2XM Labs :: Rate this Message:

Reply to Author | View in Thread

Hey Suki,
 
I don't think it matters if you're working in lat/lon or in x/y. If you look at the example you sent on that link, the difference between x/y and lat/lon is only translations/scales. So you can take the code he puts on his blog (if his license allows you to) and use it for your own application.
 
Cheers,
 
Antoine Azar
2XM Labs
645 Wellington W.
Montreal, Quebec
H3C 1T2, Canada
T. 514-606-4821
http://www.2xmlabs.com
 
 


From: papervision3d-bounces@... [mailto:papervision3d-bounces@...] On Behalf Of Suki
Sent: Tuesday, July 07, 2009 12:11 AM
To: papervision3d@...
Subject: [Papervision3D] Positioning a 3D marker on a sphere based on asub-MC in its movieclipmaterial

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 * (Math.PI/180);
var lo = MovieClip(MovieMaterial(sphere.material).movie).dot.y * (Math.PI/180);
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 there?


_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org

 « Return to Thread: Positioning a 3D marker on a sphere based on a sub-MC in its movieclipmaterial