• ### Announcements

#### Archived

This topic is now archived and is closed to further replies.

## Recommended Posts

I have 2 vectors one looking in the players direction and the other is the up vector that points to the players ''UP'' I need to create 2 radars one showing left right and forward and backwards oraintation from the player, and the other showing up down, left and right orinataion from the player. How would I got about doing this? I have done a lot of work on it and I have gotten no wear. thanks.

##### Share on other sites
You have a forward and up vector so the cross product of the two will give you a right vector. It seems safe to assume the players position would be the origin. So first you translate the coordinates so that they are relative to the player, i.e. (x,y,z)-(px,py,pz) where (px,py,pz) is the players position. Next you find the coordinates relative to the players axes, i.e. forward, up and right. You do that with a dot product. So ((x,y,z)-(px,py,pz)).up to find the up component. Since the dot product is distributive and the players position is fixed at a given point in time you can use (x,y,z).up - (px,py,pz).up and just calculate (px,py,pz).up once for all points. Next you project onto the forward/up and forward/right plane which means simply take the corresponding components. Since matrix multiplication is the dot product of a row with a column you can form a matrix from the forward, up and right vectors and multiply it by the point. If you use homgeneous coordinates and 4x4 instead of 3x3 matrix you can also do the translation. That gives you one matrix times each of the points.

##### Share on other sites

I take all the objects that appear on radar and I make the player the origin by ObjectLocation-PlayerLocation. then I need to orintate the new coords to match the players orintation and that is what I need help on. So could you expand on this and try to explain to me better how I could do this. I also understand how to get the right vector.

So I now have all 3 vectors.
they are ready to be orintated.

so how do I orinate the coords to match the players ship.

thanks.

##### Share on other sites
The component of vector v along vector n is given by (v.n)/|n| where |n| is the magnitude of n. The relevance of that is that n is your axis. So the component of the vector (x,y,z) along the x axis is given by (x,y,z).(1,0,0)=x*1+y*0+z*0=x. With that simple case you normally just take the x component, but that is what you are actually doing. Here whatever you choose to call the x axis (forward, right or up) is not necessarily (1,0,0) but it works the same.

##### Share on other sites
quote:
Original post by Xero-X2
I need to create 2 radars one showing left right and forward and backwards oraintation from the player, and the other showing up down, left and right orinataion from the player.

That''s cool, I''m making that kind of radar available in my game as well. You doing any others? Did you get that from a game? Cause I thought I was being pretty original when I thought of it.

##### Share on other sites
hmmm I think that most if not all have those radars... but they are very good to have..

anyway I found a solution.. I made 2 camera matrices and used those to make the points orintated correctly then I drew those with in the range of the radar. It works and it works well. I don't know what you were explaining to me that well for all I know I did just what you where talking about... I don't know but this works atleast.

  camera matrixRIGHT.x   RIGHT.y   RIGHT.z   0UP.x      UP.y      UP.z      0FORWARD.x FORWARD.y FORWARD.z 00         0         0         1

[edited by - Xero-X2 on January 21, 2003 6:07:23 PM]

##### Share on other sites
I haven''t seen any games use that kind of radar, I''ve seen 3 types

freespace - 1 large circle, the inner portion is what''s ahead, the outer portion is what''s behind you

g police/darklight conflict- presented with a view of a circle at an angle, dots are connected to the plane of the circle by a line showing relative altitude to you(this one didn''t work too well for me)

can''t remember what game-two radars, one shows forward hemisphere, the other shows the rear hemisphere

##### Share on other sites
Yep, that was what I was talking about. I always ramble when I''m unsure of what the person on the receiving end knows.

I believe Falcon 4.0 and I would assume other flight sims have two radars. As near as I can remember you only view one at a time and it is basically a mode on a single radar display.

• ### Forum Statistics

• Total Topics
628278
• Total Posts
2981789

• 10
• 11
• 17
• 14
• 9