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

## Recommended Posts

Hello, I was thinking how to make my enemies radar rotating by the Yaw of the camera, but the problem is: I can rotate the sprite texture of the radar but not the points of enemies together. So i thought maybe there is a thing in DirectX which allow you draw on a temp buffer, draw the sprite, then draw the points, and then rotate the whole buffer then draw it. Is there a such thing ? Thanks.

##### Share on other sites
Ok, i seem to find a start point.

Rotate the sprite.

I take a point, create a line from the point to the center point on the radar.
Rotate that line by X degrees, the end of the line will be the new point.

But i have no clue on how to make this process with DirectX.

Thanks alot.

##### Share on other sites
Actually you should do something like:

- calculate each radar blip position
- rotate the radar blips based on the player's rotation

##### Share on other sites
Wouldn't there be a way around this with multiplying the world defining matrix in a different order? Like Translate*Rotate*Scale or something?

If not your best solution is some mathematical equation based on radian movement.

##### Share on other sites
I did something like that time ago:

for(;max enemies;)
D3DXVECTOR2 dir = yourPos - enemiePos[];
SpriteObj->SetTransform(&Matrix);
D3DXVec2TransformCoord(&dir,&dir,&Matrix);
D3DXVECTOR2 FinalVect(dir.x+SCREENXOFFSET,dir.y+SCREENYOFFSET);
D3DXMatrixTransformation2D(&Matrix,&D3DXVECTOR2(0,0),0.0,NULL,NULL,0.0,&FinalVect);
SpriteObj->SetTransform(&Matrix);

I mixed pseudo code and code because that are the directx 2d functions,
the variable YAW_on_Radians is the Yaw of your camera, yourPos are the
2D vector that represent your position, the enemiePos are the position of
each of your enemies, SCREENOFFSET for x and y are the offset of your screen
coordinates on pixels.

Hope that can help, my video with the radar:

the graphics part is not good, but the radar works =P

1. 1
Rutin
26
2. 2
3. 3
JoeJ
20
4. 4
5. 5

• 10
• 10
• 9
• 9
• 10
• ### Forum Statistics

• Total Topics
631752
• Total Posts
3002091
×