Sign in to follow this  

Messing with transformations.

This topic is 3484 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I know: it should be a basic concept but... I need to represent a 3d world into a radar. The game is a space-sim and i want to implement a radar like the "elite/frontier" games. I want an ellipse, that represent the plane hosting my ship, and i want to represent the other ships using segments normal to the ellipse: the segment is over the ellipse if the enemy ship is over my head, the segment is under the ellipse if it's below. For example: look at this screenshot of the game i'm developing: the radar The white segment represent an object (the space station) that is in front of me, at left edge, and a bit over the plane.. Ok? Now if i move the mouse down, and rotate the ship's nose up, i want that the segment become smaller until it reach the zero lenght: now my ship's plane contains the space station. If i raise the nose again, the segment should be have negative lenght: the space station is below the plane. Ok i need to implement this. What i want is the 3d transformation from universe coordinate to radar coordinate. On the 3d pipeline, the transformation is obtained from: worldMatrix * viewMatrix * projectionMatrix. I think that for the radar is: worldMatrix * viewMatrix i don't want the perspective correction, i need only to have the universe object coordinates relative to my ship position and my ship orientation. Now: using the formula above, seems to work for the x and z coordinate, but NOT for the y coordinate, aka the lenght of the segment. If the starship is in front of me and at the center of the screen i aspect to have a 0-lenght segment. If i move the ship down, i aspect that the segment grows, meanwhile the starbase goes up on the screen. Then, if i raise the nose, and put the starbase again at center of my screen, i should have again the segment with 0 size. No :( so i think i'm doing sometihing wrong. Is the formula incorrect? I'm missing something? Thanks.

Share this post


Link to post
Share on other sites
Assuming that worldMatrix denotes the transformation from the object's local co-ordinate frame to the global one, and viewMatrix (er, well, obviously) the inverse of the same transformation but for the camera (here the 1st person ship sight), then I don't see any reason why it shouldn't work principally for the local y axis as well. You may have to scale it down and to limit its length, but that's it. The problem must sit elsewhere.

Share this post


Link to post
Share on other sites

This topic is 3484 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this