Positioning a 3D marker on a sphere based on a sub-MC in its movieclipmaterial

View: New views
3 Messages — Rating Filter:   Alert me  

Positioning a 3D marker on a sphere based on a sub-MC in its movieclipmaterial

by Suki-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

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 Threaded | Show Only this Message

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
 
 


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

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

by Suki-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Antoine,

thanks for your reply. 

I've actually tried that - have been trying it for a few days but simply cannot wrap my head around what's wrong with my application of it. I'm getting desperate since I've spend so much time on this little part and other parts of my application were done pretty quickly.

Take a look here - http://files.getdropbox.com/u/355341/mtest02.swf - once you click on the globe an rotate it, the 3D marker should reposition itself above the "dot" MC in the globe material. 

Could you maybe take a quick look ( http://files.getdropbox.com/u/355341/mtest02.fla ) at the code and maybe tell me what I'm doing wrong? I've simplified the code to include only this particular problem - so you should be able to locate it pretty quickly.

Thank you soooooo much!




On Tue, Jul 7, 2009 at 5:30 PM, Antoine Azar - 2XM Labs <antoine@...> wrote:
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,
 

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