2d position on a 3d plane, from a 3d position.

Started by
2 comments, last by Lord Crc 15 years, 9 months ago
First off, I have no idea if that subject title made any sense. Pretty much what I need to do is, Well look at these pictures (Made in secondlife, Woo haha) http://img524.imageshack.us/my.php?image=snapshot001vv2.png http://img523.imageshack.us/my.php?image=snapshot002hk5.png What I need to do, is the get "Local" offset of Object 2(Blue box) from object 1(Red box) By local offset, I mean the Green cylinder length would be the X value, and the Blue the Y value, But without using Cylinders of course. In this case the Red cylinder is going in the direction of objects 1 local Y axis. I would also need to be able to change this for each 6 sides(Well, 3 sides I guess I would just have to flip the x for the opposite. Any ideas on how to go about this? What I was thinking would be First you need to "Cancel out" objects 2s rotation, Aka if it was on the position seen in snapshot2, change it so it would be like in snapshot 1, then simply get the offset. But I have no idea how to do this :( Something to do with a Rotation Matrix im assuming, but I have never done anything with them before :( [Edited by - kc_0045 on July 16, 2008 10:03:28 PM]
Advertisement
Okay, After thinking it over pretty much what I need to do is get the 2d position on a 3d plane, from a 3d position, one way I was thinking of would be to use Perspective projection, where the viewer position would be the same as the plane, would that work?

I got the idea from http://en.wikipedia.org/wiki/Perspective_projection#Perspective_projection

But would there be a simpler way of doing this? :S
you can use matrices. multiply the inverse matrix of one by the transform matrix of the other to get the other's matrix transform relative to the first. Then you can get the pos/rot... whatever from this matrix. ciao!
Or you could project the position onto the plane.

This topic is closed to new replies.

Advertisement